Model-View-Controller in Web 2.0

by Fraser Speirs

In Software Engineering, the Model-View-Controller pattern is well established. In such an architecture, data is held in a data model that represents the relationships between all the different parts of information. Access to this data model is mediated by a controller that ensures that the model stays consistent, and users interact with the data through a view - a particular human-understandable representation of the data and its relationships.

One of the big wins of the MVC pattern is that you can have multiple views onto the same data. You could represent a database as a a number of tables with rows and columns, or as a set of circles with connecting lines representing the relationships between the data objects.

Another example: remember when Apple introduced the system-wide Address Book in Mac OS X? It was a fine 1.0 product, but of limited application because only Apple internal applications could integrate with it since the API wasn't public. At that time, the model and the view were combined so there was only one view possible - Address

Then, in Mac OS X 10.2, Apple introduced the Address Book Framework. In doing so, they separated the model (your contacts) from the view (Address by inserting a separate controller (the Address Book Framework) and thus made it possible for third-party applications to read and manipulate the model. Suddenly the value of putting all your contact data in one place grew significantly. Suddenly Delicious Library could use your contacts as a database of book borrowers, you could link to contacts in VoodooPad, you could do all kinds of things. The actual Address Book application was just one way to look at the database.

In the Web 2.0 apps that really Get It, they have a database backend, a web frontend and - crucially - some kind of web services API in between. Flickr is a great example of this kind of architecture - almost everything you can do through the Flickr website can be done programmatically through a desktop application.

The way I hope Web 2.0 will evolve is with web-based and native desktop applications hand-in-hand. Think about it like Address Book - with a database backend (the model) and a web services API (the controller), the actual web site itself becomes just one of potentially many views on the data. That other view could just as easily be a native Mac OS X application that calls the site's API.

The future shouldn't be looked at as being a battle between web apps and desktop apps - it should really be both at once, in hopefully perfect harmony, each playing to their strengths. Far from a harbinger of the death of the desktop application, I think Web 2.0 - if it means anything at all - means that we're entering a new golden age of development on the desktop.

The acquisition of NetNewsWire by NewsGator is a prime and recent example of a Web 2.0 company recognising the importance of giving users a native dektop application to view the same data that they can view on the web.

Thoughts on the role of desktop applications in Web 2.0?


2005-10-13 17:51:59
iCal is an even better example
Totally agree, and iCal is an even better example: