Chapitre II - MVC
Chapitre II - MVC
NTIC TLSI L3 GL
§ Design patterns describe standard solutions for addressing software architecture and
design problems.
§ They are reproducible solutions to problems that commonly arise in software design.
2
§ System architecture is used to define:
- Microservices
3
§ The MVC architecture is a model of software architecture
in which the application logic is divided into three
components based on functionality. These components
are called:
§ Model: how data is stored, managed, and manipulated.
§ View: components visible to the user, such as graphical
interface.
§ Controller:
the components that serve as an mediator
between the model and the view.
§ The MVC architecture is used not only for desktop
applications but also for mobile and web applications.
4
MODEL LAYER
The Model layer plays a crucial role in managing the application's data, logic, and behaviour.
It is composed of two layers : Data Access Layer and Business Logic Layer
6
MODEL LAYER
2- Business Logic Layer
§ Itencapsulates the business logic and rules that govern how data is processed,
manipulated, and transformed within the application.
§ This includes operations like validation, calculations, and any specific algorithms that
pertain to the data.
Presentation of Data:
§ The View is responsible for displaying data from the Model layer to the user in a human-
readable format.
§ It formats and arranges the data for presentation, which may include rendering text,
images, forms, and other UI elements.
8
VIEW LAYER
Independence from Model and Controller:
§ The View is independent of the Model and Controller layers, which promotes a clear
separation of concerns.
§ This allows for more modular and maintainable code.
No Business Logic:
§ The View should not contain any business logic or data processing.
§ It should focus only on presenting information.
9
CONTROLLER LAYER
The Controller layer acts as an intermediary between the View and the Model. Its main
roles and responsibilities include:
Deciding Actions:
§ Based on the user input, the Controller determines the appropriate action to take.
§ It decides which part of the Model (business logic) to interact with, what operation to
12
§ Tier 1: Client is a web browser.
database server.
13
Web Server
Data Access
DataBase
Layer
Client HTTP
Mobile app View