WHERE AND WHEN TO USE THE MVC PAT TERN
The most prolii c use of the MVC pattern is in web applications, although you can use it anywhere
there is a benei t to separating the view logic from the business logic. In fact, the use of the MVC
pattern in web application architecture is so ubiquitous that any suggestion not to use it would be
met with derision and disdain.
There is no doubt that the two principle benei ts of using the pattern are strong. Its separation of
concerns makes for a l exible and adaptable web application, and its separation of production allows
different parts of the application to be developed virtually independently of each other. For example,
one team can work on the display logic while separately another team can work on the business
logic and domain objects.
The MVC pattern has many commentators offering their point of view on its use, implementation,
and even validity. You will read my interpretations of this pattern and see many implementations. It
can be confusing to see the real benei ts of this pattern.
You should go back to the essence of the MVC pattern: the separation of the display logic from
the business logic. If you implement code that stays true to this objective, you have successfully
implemented the MVC pattern.
The concept behind a separation of presentation and business logic is to maintain a clear divide
between domain objects that model your problem and the presentation of that logic. This separation
allows the business data to be presented in any number of different ways, simultaneously and
without the need for the domain object to know anything about the way it is being displayed. It
could be displayed on the screen in a variety of formats or as Word or Excel i les.
Develop the example in the chapter further by adding different views to display the user list.
1. Professional website of Trygve M. H. Reenskaug: http://heim.ifi.uio.no/~trygver/