Welcome Guest, Not a member yet? Register   Sign In
Must-read MVC Article
#1

[eluser]Colin Williams[/eluser]
If you are struggling to understand MVC, stop what you are doing and figure it out before you continue (mis)using a MVC framework. A great place to start might be Jonathan Snook's new article on alistapart.com, "JavaScript MVC". Sure, it focuses on JavaScript, but another tool you need at your disposal is the ability to extrapolate. Jonathan's article offers the clearest breakdown of basic MVC separation I've seen yet (other than maybe the short quote he uses early in the article).

MVC is purposely simple. If you think it is complex, you might just be over-thinking it. Here are some gems from the article:

Quote:If we had a calendar of events, the event data would be stored in its own object. Methods added to the object abstract the process of interacting directly with the data.

...

In the MVC pattern, the View accepts data and determines how to display it.

...

Making Views aware of the data model and data retrieval method is an easy trap to fall into. Separating those functions, however, allows us to reuse code for other things.

...

Now, how do we get the data from the Model to the View? That’s where the Controller comes in. A Controller activates after an event occurs.

...

Controller actions become simpler and easier to understand. This is key to building a maintainable application.

And then this is definitely one to consider:

Quote:However, there are situations in which Views should handle their own events or run their own methods. For example, a View could have an input range with a slider that allows the user to pick the value. The View handles the logic for that slider interaction and how it displays the resulting value. There’s no need to have a Controller micromanage that interaction.
#2

[eluser]wiredesignz[/eluser]
Thanks for this Colin.
#3

[eluser]renownedmedia[/eluser]
I never would have considered MVC for Javascript... Good article




Theme © iAndrew 2016 - Forum software by © MyBB