Programming Concepts Series – Part 1
This is the first installment of a new series designed to introduce non-programmers to some foundational computer science concepts towards a better understanding of the development process. We decided to begin with MVC.
MVC is a pattern of software architecture/development that divides an application into three interrelated components: Model, View, and Controller. MVC is designed and implemented to improve maintainability and provide Separation of Concerns.
Originally applied to desktop applications, MVC has become an important architectural/design concept for web-based applications over the last decade or so with frameworks like Ruby on Rails, Django, and the ExpressJS+NodeJS+MongoDB stack.
The Model is responsible for managing the the data, logic, and rules of an application.
The controller accepts input and converts it to commands for the model or view.
A model stores data that is retrieved to the controller and displayed in the view. Whenever there is a change to the data it is updated by the controller.
A view requests information from the controller. The controller fetches it from the model and passes it to the view that the view uses to generate an output representation to the user.
A controller can send commands to the model to update the model’s state (e.g., editing a document). It can also send commands to its associated view to change the view’s presentation of the model (e.g., by scrolling through a document).
MVC and Web Apps
When considering which platform to recommend to a client, it can be useful to think about the core logic involved with the application. Applications with relatively light-weight logic and simple data-queries may be best suited for more View or client-heavy framework such as AngularJS or Backbone, whereas those with extensive logic and/or complex data-queries might be better candidates for a Model-heavy framework like Ruby on Rails. This is of course not the only thing to consider when choosing which framework is right for your client, but it can be a good starting point. Having members of your new business team, for example, understand the concept of MVC (as well as other basic CS concepts) can go a long way towards tailoring the right pitch for a potential client.