MVC Simply Explained

 You probably have heard of this MVC before, and wondered what is it. In simple words, it’s a design pattern that makes your code organized, easy to read and most importantly super-fast to debug!

There are many design patterns such as MVVM, MVP, MVC and in this article I’m going to hone in on the MVC design pattern.

So Let me start off by explaining what MVC is.What do those three letters stand for. Well, let me break it down for you. MVC stands for Model, View, Controller. Each one of these serve a specific function. As you know any application consists of several parts. Firstly, the visual part which the user can see and interact with and this is called the View. For example, the view in web development is simply the Html and CSS code. So the View is just a layer that would let the user see it and interact with it. Simple enough.


Then we have the second layer which is the Controller. It’s what is happening behind the scene. Say that the user visited a flight booking website and wants to get info about a certain flight, like the departure time, dates, price, etc. They will first interact with the view by, probably, clicking on a button to get this info. Once the button is clicked we need some mean that will respond to this and that is called the Controller which will respond to what a user wants and do what needs to be done. In this case the user wants flight info. The controller then turns around and talks to the third part of the application which is the Model. The model is like a storage. It gets info from Database and gives it to the controller. The controller might edit this info then deliver it to the user. Finally, the user will be able to see flight info.

Some programmers fail to see the important of using MVC. Those who do so are usually inexperienced programmers or have not built advanced projects. If you want to build a simple application, it’t not necessary to use MVC design architecture because at the end of the day, you just want a simple functionality. However, if your project is going to be an advanced one, say an e-commerce web app, then it’s so important to pick out a design architecture, otherwise as your code gets bigger and as your project gets complicated you will, at some point, lose control over it. And trust me you have no idea how it feels like to lose control over a project. So if you fail to plan then you plan to fail, keep this saying in mind!

In conclusion, the view does not contact the model directly, instead, it contacts the controller which works as a connection point between the view and the controller. In other words, the controller works a waitress. A waitress takes orders from a customer, turns around and go to the kitchen to get food (Model) to the customer to enjoy!


Wanna Learn How to Become a Freelance Programmer?

Learn All Secrets Now!

Add a Comment

Your email address will not be published. Required fields are marked *