What is the Model View Controller design pattern?

Sehinde Raji
3 min readNov 1, 2017
The MVC pattern explained

What is the model view controller pattern?

The model view controller is a software pattern that is used for web development services such as applications; irrespective of the language. It is one of the most widely used paradigms in web development.

What components make up the MVC architecture?

Model
The model is the main component within the pattern and it manages the data, logic and rules of the application.

The model structures and stores the data within the database and it is subject to the controller’s commands.

View

This is the output representation of the data in the form of a screen and / or user interface (UX).

You can imagine this to be the DOM or document object model that you use within an application to prescribe behaviour to the view.

Controller

This accepts the input and sends commands to send to the model, the model then outputs the view to the user of the application.

MVC in action within a Laravel application

If you create a new web development services based Laravel application, one of the most important things to consider is the model.

Model first

This is usually the first thing that is created in the form of a table. The table is created and this consists of the individual fields that make up the model.

Controller second

Next we usually create a controller. This is the processing entity that is used to convert the data in to the view.

View third

Finally we create the views that will be used to service; say; a web development services application, and we create these under the resources/views directory within a Laravel application.

Here is a diagram that shows the MVC pattern in action:

MVC pattern in action

It is important to understand that the MVC design pattern allows the components to be loosely coupled within the same environment. This allows you to create separate, re-usable components that can be easily modified.

This means that the time taken to develop applications is faster and more efficient in the long run. Especially when you consider the fact that if your customer needs to make a change to the MVC pattern. It wouldn’t take long to make those amendments or to change the models etc.

The model view controller concept is one of the basic tenets of computer programming and this is a very useful paradigm to learn when you are a newbie to the world of tech and are trying to earn a living by providing various web development services and projects.

It is important to know how to map the model view controller concept to your own projects.

The reason being that it helps to reinforce your understanding and awareness conceptually of how loosely coupled components communicate.

--

--

Sehinde Raji

The Diverse Coder, Entrepreneur, Mentor & Teacher who is passionate about diversity