Author: Mitch Daniels, Back-End Digital Developer
Development is a vast and multifaceted world that many can get lost in when it is an unfamiliar environment to them. As a developer, I find it to be in my best interest to act as a guide to those who feel lost. In this post, I will provide a brief summary of a commonly used architectural pattern for development, and then hopefully provide a better understanding of it through American football.
Model-view-controller, or MVC for short, is a method of organizing the source code of a development project into three distinct components associated with various programming languages, the most well-known of which is ASP .NET MVC framework. MVC breaks core sections of the project into three components that can be illustrated using the following parts: models as teams or squads, controllers as the playbook plays, and views as the executed play on the field.
In an application, models are your primary datasets, made up of properties that help define how the data is managed. Models mirror offensive, defensive, and special team squads, while the players that make up those squads represent the properties that make up the specific model. To act as the playbook for the models/squads, you have the controllers that are made up of various functions – or plays, to maintain the analogy – that detail how the application interacts with the models/squads and its properties/players. Finally, we have the views, which represent the controller’s output, similar to when the squad of players execute the playbook plays on the field, and like an audible on a play, things can change the output of the view as the user interacts with it.
This is a vast oversimplification of the core MVC structure, but hopefully it provides a perspective that is easier for some who may not have the same grasp of development. At the very least, our football analogy gives a rudimentary understanding of the MVC structure.