February 17, 2010

What is MVC in few simple words

Today I read an excellent post on FW/1 mailing list. My impression came from ideal I try to follow in my life: "perfection lies in simplicity". I was, several times in situation to try to explain people what MVC (framework) is, and discovered that unexperienced developers have a problem to chew up that subject. One more thing I am sure about is that usually it is a problem with how things are presented more then to whom they are presented. However, this man, Ryan Cogswell, did it in 5 simple sentences. So, for everyone who are still not clear what MVC framework is and how it works, and for me who will use his words to explain others, I'll quote:



You can use views at different levels of granularity (views can use other views), but start with one view for each page.
 As a general guideline, your views should only contain display code not data retrieval or processing logic. The controllers/services should take care of the non-display logic. If you don't yet understand the difference between services and controllers, then keep it simple and put all of your non-display logic in controllers and don't use services.
 Services and beans are just options for how to organize code into different components. Views and layouts provide options for organizing display code into different cfm pages. There are potential benefits to using these framework features, but they do not prevent you from continuing to use the ways you have previously organized your cf code.

Don't get me wrong. This, by itself, is not enough to completely understand MVC pattern, but when (and if) you found yourself unsure or lost in process of learning, get back on this quote I am sure that everything will be much more clear....if not completely :)

More about this:

No comments: