Intro To The MVC Architecture

Writing clean code is as important as having a functional software program. This is why most modern web applications are organized following a MVC architecture. 

MVC stands for Model-View-Controller. When you use a modern web framework like Symfony, Laravel, or Ruby on Rails, you implicitly follow a MVC architecture to make your code easier to read.

The Model is the part managing the data, logic, and rules of your application. This is where you write the web services that will interact with the data access layer.

The View presents the data. It can include user interface components or JSON, for example. When you use a front-end framework like React or Vue, you work at the View level.

The Controller is the bridge between the View and the Model, handling all the user interactions with the application. It defines the routes, handles all the incoming requests, and translates them into commands for the Model to generate the View.

Ideally, you want the Controller part to be as small as possible and leave the data processing to the Model: “Fat Model, Skinny Controller”.

Of course, MVC is not the only way to build modern web applications. But it’s the most common one and other alternatives follow the similar approach of separating the presentation from the rendering process and the business logic.