The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
MVC: In layman's terms

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
David Heinemeier Hansson

Posts: 512
Nickname: dhh
Registered: Mar, 2004

David Heinemeier Hansson is the lead Ruby developer on 37signal's Basecamp and constructor of Rails
MVC: In layman's terms Posted: Mar 24, 2004 12:00 AM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by David Heinemeier Hansson.
Original Post: MVC: In layman's terms
Feed Title: Loud Thinking
Feed URL: http://feeds.feedburner.com/LoudThinking
Feed Description: All about the full-stack, web-framework Rails for Ruby and on putting it to good effect with Basecamp
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by David Heinemeier Hansson
Latest Posts From Loud Thinking

Advertisement

MVC is a pattern for separating the three basic concerns of a web application into isolated tiers, which can be constructed, tweaked, and tested apart from the others. MVC is short for Model, View, Control.

The model is composed of business classes, such as Person, Project, Account. The Project class has methods like has_milestones?, save, get_project_lead, and so on. This is the world of abstract ideas in a Plato-sense of ideals.

The view is the HTML templates that knows how to format and display the model objects, like "Title: <%= @post.title %>" (which shows the title of the post object). There's no computations and very little logic in the templates (or at least that's the way it should be).

The controller ties the view and model together by determining which models to give to which view and a given request. Or how to update the model as a request prescribes and redirect the user some where.

This might appear as a somewhat elaborate scheme. And in a way, it is. You probably wouldn't structure your guest book application like this. Having it all mashed together is fine for that.

But as soon as your application grows to even a moderate level of complexity, there's an incredible benefit to be found in the MVC approach (or similar patterns for separating concerns). You decrease duplication, promote coherence and clarity, make it possible to test, and a world of other benefits.

Since all MVC-style applications relies on a number of shared principles, it's possible to abstract and reuse these in what's called a framework. Rails is such a framework that tries to remove the complexity and drudgery of MVC, while still allowing you to realize all the benefits.

This description is a reprint from the discussion of Ruby on Rails to Basecamp from Signal vs Noise.

Read: MVC: In layman's terms

Topic: Linux Journal Article on OpenOffice and Ruby Previous Topic   Next Topic Topic: New

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use