Model-View-Controller and the Separation of Labor

Few architectural choices are more critical for your project’s success than MVC (model view controller). The idea being that by separating code into three separate entities, the application can grow more naturally and be easier to update.

To give some context around the premise for MVC, here are the words of Trygve Reenskaug, one of the first  MVC practicioners:

I have sometimes been given more credit than is my due, so I should stress that I am not one of the original inventors of Smalltalk. I am only one of the very early and very enthusiastic users and contributors to this revolutionary innovation. I made the first implementation and wrote the original MVC note at Xerox PARC in 1978. The note defines four terms; Model, View, Controller and Editor . The Editor is an ephemeral component that the View creates on demand as an interface between the View and the input devices such as mouse and keyboard.

Jim Althoff and others implemented a version of MVC for the Smalltalk-80 class library after I had left Xerox PARC; I was in not involved in this work. Jim Althoff uses the term Controller somewhat differently from me. An important aspect of the original MVC was that its Controller was responsible for creating and coordinating its subordinate views. Also, in my later MVC implementations, a view accepts and handles user input relevant to itself. The Controller accepts and handles input relevant to the Controller/View assembly as a whole, now called the Tool.

The essential purpose of MVC is to bridge the gap between the human user’s mental model and the digital model that exists in the computer. The ideal MVC solution supports the user illusion of seeing and manipulating the domain information directly. The structure is useful if the user needs to see the same model element simultaneously in different contexts and/or from different viewpoints. The figure below illustrates the idea. – Trygve Reenskaug

So MVC is an architectural choice that separates layers of simulation in computer programs to facilitate development and improve performance. However, MVC is also pivotal in another dimension: it fosters the division of labor in teams.

MVC splits the code repository into manageable units that map directly to design craftsmanship, database development and business logic coding. Thus, by using MVC your team can work in parallel and improve the platform while interfacing with much simpler repositories; SOAs (service oriented architectures) and code repository management and versioning tools (like Github) can further help in this process. At the very end of a successful MVC implementation, your team can enjoy multiple cycles of iteration, a clean division of labor and easier code management.

For example, controller classes can hold all the logic of your application and serve as the “head” of your system, making debugging and optimization a far easier task than putting the code say in a DBMS (database management system).

The MVC pattern is a pattern that was originally designed for desktop applications, but has since been co-opted by the web development world. Its core design principles are driven by the desire to maintain separation of concerns in a web application, splitting out the data layer and the view layer and separating them with a controller layer that drives the application flow. By focusing on implementing your application in an MVC pattern, you can greatly ease the development process by maintaining separation of responsibility, developing an application that is truly robust and maintainable. – Backand Blog

Even if you’re not on the technical side of things, getting familiar with the basics and studying a little bit of computer history can help you become a better product manager.