Tuesday, June 5, 2012

MVC now and then.

The history of MVC can be traced back to the early 80's. It was a key component of Smalltalk.

In the past 10 years, MVC has became a standard way to write web applications. Take Java for example: the usage of Struts, a popular Apache project for writing web applications, reached its peak in 2005. I still remember that everyone with struts experience on their resume would easily get interviews around that time.

Fast forward to year 2007/2008,  RoR became a mainstream MVC framework, partially because it's made available on Mac.

With the latest hype of HTML5 and JavaScript, a new breed of browser level MVC frameworks have emerged.  The general concept is to treat client browsers as full "applications" instead of just frontend UIs or views.   AJAX/JSON is the new model, HTML and CSS are the view, and JavaScript is the controller.  There are several popular JS level MVC frameworks, SproutCore, Backbone.js, and etc.  I haven't had a chance to play with them.  But in all the frontend projects that I've done in the past 12 months, I definitely tried to push model and controller all the way to the browser level.

Another revolution is that with transitioning MVC to the browser, the backend data layer is also evolved into its own MVC.  Backend data are still models, JSON data is the new view, and Java/php/C# or other backend logic is the controller.


Anonymous said...

Hey John - This is an interesting topic, and the technology is still evolving. In the ideal world, you specify a database schema, and a template file and an AJAX application is built out for you. The default template/view might consist of a basic CRUD interface. As things stand (at least from what I know), you have to hand-write the javascript code to fetch data from the backend when various UI actions take place. I believe ASP.Net does try to do stuff like this, but MS stuff tends to be rather monolithic. May be node.js has some good framework for this. - Anand

CodeSith said...

JS MVC framework such as Ember.js actually binds JS objects to AJAX calls.