MVC / Three-Layer
In depthConcept
Also known as: Model-View-Controller, Controller-Service-Repository, Drielagenarchitectuur
Architectural pattern that separates code into presentation, business logic and data access.
MVC / Three-Layer, explained
Written by EduVerseWhat it is
MVC (Model-View-Controller) is an architecture pattern that splits an application by responsibility: the model holds the data, the view shows it, and the controller handles incoming requests. In backend work you’ll often meet a close relative, the three-layer setup of controller, service and repository.
Why teams use it
When request handling, business rules and SQL all sit in one file, every change risks breaking something unrelated. Separating the layers gives each piece of code one job: the controller deals with HTTP, the service holds the business logic, and the repository talks to the database. That makes the code easier to read, test and change.
An example from work
You’re asked to add a discount rule to checkout in a Spring Boot project and find three folders: controller, service and repository. The rule doesn’t belong in OrderController, which only handles the request, or in OrderRepository, which only queries the database. It goes in OrderService, where the rest of the order logic lives.
Our own explanation, not a quote from the book.
Where it fits
Structuring backend applications
Coverage in the book
Covered in depth: multiple pages with explanations, examples and simulations.