MVC Pattern and Frameworks

by Arlyn R
The article (2012), “Journey through the JavaScript MVC Jungle,” introduces the Model-View-Controller (MVC) pattern and offers resources to finding a JavaScript framework that provides organization and structure, while meeting the specific needs of a developer’s web application project. The author of the article, Addy Osmani, advises that MVC pattern helps structure code by breaking down the application into three sections: models, views, and controllers. The model in MVC handles the “domain-specific knowledge and data in an application (Osmani).” View holds the code for the user-interface and contains the presentation logic. Controllers in MVC respond to the user actions (business logic). The author further explains that not all frameworks follow the MVC pattern but will include the controller information in the view or some other component, therefore refers to these other frameworks as MV* pattern. Osmani advises that JavaScript MV* framework is best used when the web application communicates mostly with an API or back-end data service and he provides GMAIL and Google Docs as an example. So, MV* frameworks are more efficient for applications with tasks that do not rely on the server for the presentation logic of an application. Osmani also provides criteria and questions that are helpful for a developer when choosing a framework. The author suggests to review the features and code of the framework. If the framework has proven its operability in production, it can help determine if the framework fits the developer’s needs. The author also suggests that a well-documented framework can save a developer a lot of time, since information can be easily accessible and referenced. The article then reviews a handful of MV* frameworks such as Backbone.js, Ember.js, AngularJS, Spine, CanJS, DOJO, JQuery, and describes which type of applications they are best utilized. Finally, the author also provides pros and cons given by developers for the most popular frameworks to further support a developer’s decision for a chosen MVC framework. read more...

Read more