top of page

What Is MVC And Is It Still Popular?

MVC is an acronym that’s commonly asked on interviews for full stack development or general software engineer positions. Why should we use it? They’re very popular questions. JT1 will explain what it is in the following post.


MVC (Model – View – Controller)

M stands for MODEL, V stands for VIEW, and the most important part is C – CONTROLLER. MVC is a standard convention across large codebases, a pattern used on several teams across the world. Tech engineers and developers working on user-facing projects are indoctrinated with it.

  • Model: They are classes in using to store and manipulate state, normally in a database.

  • View: User interface bits (HTML in this case) necessary to render the model to users.

  • Controller: Brains of any application. It determines what the user's input is, how the model needs to change to fit that input. Then choose a resulting view which is the most appropriate for users.

In some programming languages, there is no such thing as MVC. It is either a moot point for some programmers or an altogether irrelevant question, a matter of no significance.

To restate, certain languages have no concept of MVC, resulting in a half-finished software design pattern. Besides that, several applications may not require the convention of MVC. Regardless of this, it is still useful in certain situations.


MVC in browsers (SPAs)

With the advent of React, Angular, and Vue, MVC has become vastly diminished.

For example, let’s consider a typical React application. How can we classify the model, the view and the controller?

In most cases, the view is your React component, the controller is missing, and the model is hard to determine, but “follow the data” and you might find one.

Optionally, if you are using Redux, designating MVC pieces will become much easier. Reducers in Redux work in a similar fashion to a controller. They transform and modify the underlying model within an event-based system.

Redux utilizes reducers as mediators who react to the changes in the state to keep your components updated. This setup actually shares a lot with PureMVC, which ironically doesn’t strictly need MVC either.


MVC in video games

Another common application where MVC also has some problems is a typical video game.

You may have a model somewhere, maybe character information stored in a database or game saves stored in a filesystem. You will probably have a controller, like the code to control a character, which is not the same as what we use in the role of web developer.


MVC with Server - Side

On the other hand, MVC is quite useful if you don’t solely depend on JavaScript/SPAs. Often HTML is one of the most popular ways that users consume your content. In the modern world, your main concern is getting data to and from your devices, whether they be a browser, app, desktop, or video game.

From this sense, another thing apparently replacing it are systems such as GraphQL or Falcor. And JSON or XML is another view of your content while with MVC sometimes people incorrectly think that the “V” - the view, is always going to be HTML or UI components. That’s not always the truth.

In my opinion, XML, JSON, CSV, and other file containers are exactly the same thing as HTML — a script or markup type language; they structure content, but they aren’t designed to show content to end-users. They show the content much like HTML does. HTML is different owing to a browser, which will make it look nicer to viewers.

With things like GraphQL and Falcor, JSON replaces the view, which is still MVC.


Does it still matter in this modern world?

Regardless of whether we are using Rest APIs, GraphQL or Web Sockets, we’re still using some form of MVC.

As part of a healthy team of like-minded developers, use it as you see fit, and be careful of trying to make new naming schemes or conventions where you put a new coat of paint onto MVC terminology. Therefore, every layer in MVC is assigned with a unique responsibility in which the View is for the look and feel as well as for positioning what the end user will actually see, the model supplies the data and business logic, and finally, the models are nothing but just a class which can interact with the data access layer, some kind of service, like WCF Service or Web Service. The controller is actually the heart of MVC, like a film Hero, it deals with both the layers. Data request from users and the controller goes straight to the model class. So, this also refers the coordinator between the Model and View.

The difference between MVC and Web forms

Why only MVC does not have Web forms? Let's have some background approaches of ASP.NET, which will explain more scenarios of the difference between it and Web forms.

Let’s begin with Windows background. It is introduced with the word visual and desired to have the same success story as Windows used in programming a lot of languages like COBOL, C++, and DB’S. All these languages do not have any Visual effect, so if you want to fix a button in C++, you have to write its own code. Hence, Microsoft started something called RAD programming (Rapid App Development) for creating a window Microsoft introduced tool box. From this point, they launched Visual Studio and again, Microsoft got success. At that time, power builder was completely replaced by VB, like VC++ was replaced by C++ and VF (Visual FoxPro) almost killed it and it replaced DB. The RAD programming is cool, but it leads to some backend code issues. In other words, when the programmers drag and drop, they are generating code in partial class.

The power and simplicity of MVC is undeniable. But the first step to taking advantage of MVC is to understand how and why it works, both on the web, and also within your own applications.

 

-- You are worrying whether to choose a reputable address to look for IT jobs or intend to apply for vacancies at top IT companies in Vietnam and Southeast Asia? Please don’t hesitate to click for explore more information about positions at: https://www.jt1.asia/top-it-jobs

-- You are an IT Company or IT Employer finding experienced IT candidates but have some difficulties in recruiting. JT1 - IT Recruitment Agency has been providing IT specialists in positions from our database with 20.000+ qualified candidate profiles completely in IT. JT1 has cooperated and satisfy the demand of professionals IT Recruitment for more than 1000 employers all over Vietnam, including leading companies in the IT market. If you have any further questions, please follow and don't hesitate to contact us at: https://www.jt1.asia


____________________

JT1 - IT Recruitment Agency

Email: hi@jt1.vn

Phone: +8428 6675 6685

More posts at: https://www.jt1.asia/blog Follow us on facebook at: https://www.facebook.com/jt1asia

bottom of page