What is ASP.NET MVC?

Raphael Lima Fernandes
Everything for Developers
3 min readMay 14, 2018

Do you know what is ASP.NET MVC?

Hello dear reader, I am migrating my posts from Blogger to Medium, it is my first post.

Well, let’s get started, MVC means Model-View-Controller and it is a design patter which separates the application in three main components:

  • Model: Nothing more than a class. Yes, it is only a class, but a class that stores the attributes needed for the application, model has all the business rules and all the data manipulation. Summing up, model is a class with everything you need to manipulate data.
Example of a model
  • View: View is the HTML that users can see, Views uses the Razor Engine, implementing the use of Helpers. You can also use Models to bind the data.
Example of a view
  • Controller: Controlle is on the middle between Model and View, controlle receives all user’s requests and then manage it.
Example of a Controller

To clarify your mind, let’s see how would be a chat with Model, View and Controller:

View: Hey Controller, how are you? User has made a request, could you please manage it?

Controller: Hey Model, user wants to login on LinkedIn, could you please get these data and validate if it is ok?

Model: It is ok, user is able to login

Controller: Thanks Model. View, the data sent by user are ok, I am going to send to you the user’s data, and could you please load the profile page?

View: Thanks, I am loading.

MVC Advantages:

  • MVC makes easier to manage complexity by diving an application into model, view and controller.
  • It does not use view state or server-based forms. This makes the MVC framework ideal for developers who want full control over the behavior of an application.
  • It uses a Front Controller pattern that processes Web application requests through a single controller. This enables you to design an application that supports a rich routing infrastructure.
  • It provides better support for test-driven development (TDD).
  • It works well for Web applications that are supported by large teams of developers and for Web designers who need a high degree of control over the application behavior.

When should I use ASP.NET MVC?

There is no rule to decide when you should use ASP.NET MVC or Web Forms, ASP.NET MVC did not come to replace Web Forms, but to be one more option in Web Development.

You can find an example of an application which uses ASP.NET MVC, and other technologies, in my GitHub: https://github.com/rlima05/SOLID-DDD

--

--