MVC (Model-View-Controller) is an architectural pattern that divides an application into three interconnected components to separate internal representations of information from the ways information is presented and accepted by the user. It is the most widely used architectural pattern in web development.
The Data Layer. Contains the business logic, data structures, and rules. It directly manages the data, logic, and rules of the application. The Model is completely independent of the user interface.
User class with fields (name, email, password), validation rules, and database operations (save, find, delete).The Presentation Layer. Displays data from the Model to the user. It is a visual representation of the Model. Multiple Views can exist for the same Model (a web page, a mobile app, and an API all showing the same data).
The Logic Layer. Acts as the intermediary between the Model and the View. It receives user input from the View, processes it (possibly updating the Model), and determines which View to display next.
| Framework | Language | MVC Role |
|---|---|---|
| Spring MVC | Java | Full MVC with annotations |
| Django | Python | MTV (Model-Template-View, Django's variation) |
| Ruby on Rails | Ruby | Convention-over-configuration MVC |
| Express.js | JavaScript | Lightweight, requires manual MVC structure |
| ASP.NET MVC | C# | Full MVC with Razor views |