Software Architecture: Layered Model (MVC, n-Tier)
This article is a glossary entry covering the layered model – including exam questions, core components, and key concepts.
In a Nutshell
Layered models organize software into logically separated tiers (UI/logic/data). Common examples are MVC and n-Tier, which promote modularity, maintainability, and testability.
Technical Definition
In the n-Tier model (typically 3-Tier), at least three layers exist:
- Presentation
- Business logic
- Data persistence
MVC (Model-View-Controller) separates:
- View (presentation)
- Controller (request handling)
- Model (data model)
Data flows in a controlled manner through the layers, preventing unwanted dependencies. In practice, frameworks like Angular, Spring, and .NET commonly implement layered models.
Exam-Relevant Key Points
- Separation of presentation, logic, and data access
- MVC = View, Controller, Model
- n-Tier = logical architecture with 2–n layers
- Clear separation of responsibility (exam standard)
- Improves testability and component substitutability (practical benefit)
- Reduces attack surface through defined interfaces (security aspect)
- Lowers maintenance costs over time (cost-benefit)
- Architecture must be documented clearly (documentation requirement)
Core Components
- Presentation layer (UI)
- Logic/Controller layer
- Data layer/Repository
- Model classes (MVC)
- Interfaces between layers
- Validation and error handling
- Frameworks/Middleware
- Service layer (e.g., REST)
- Authentication/Authorization
- Unit testing per layer
Simple Practical Example (MVC)
Model: Product(name, price)
View: HTML template
Controller: handles "add to cart" click and updates Model
Advantages and Disadvantages
Advantages
- Clearly structured codebase
- Better testability through loose coupling
- Reusable modules
- Parallel team development
Disadvantages
- Overhead for small projects
- Higher initial effort
- Complexity from additional layers
Typical Exam Questions (with Answers)
- What is the goal of a layered model? Separation of concerns and improved maintainability.
- What are the three layers in 3-Tier? Presentation, business logic, data persistence.
- What does the Controller do in MVC? It handles user actions and mediates between View and Model.
- How does MVC improve testability? Components can be tested in isolation.
Glossary
| Term | Definition |
|---|---|
| Layered model | Separation of concerns into distinct tiers |
| MVC | Model-View-Controller for UI structure |
| n-Tier | multi-layered architecture with at least three tiers |
Key Insight
In professional projects, each layer should only communicate with adjacent layers—avoid shortcuts like direct database access from the View. For REST backends, the Controller/Service/Repository separation is standard practice.
Learning Strategy
- Draw a layer diagram for a simple application.
- Build a small MVC app using a framework.
- Review architecture diagrams and identify layer violations.
- Keep business logic out of the View.
Topic Analysis
- Technical core: Separation of Concerns
- Challenges: Dependencies, layer boundaries
- Security: Encapsulation of sensitive data
- Documentation: Architecture diagrams
- Cost-benefit: Reduced maintenance expenses
Further Reading
- https://learn.microsoft.com/en-us/aspnet/mvc/overview/overview
- https://www.baeldung.com/spring-service-layer



