0% found this document useful (0 votes)
5 views

Chapitre II - MVC

Uploaded by

Mary Norssine
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Chapitre II - MVC

Uploaded by

Mary Norssine
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

Faculty Department Level Speciality

NTIC TLSI L3 GL
§ Design patterns describe standard solutions for addressing software architecture and
design problems.

§ They were created as a solution to common issues encountered during software


development.

§ It is a software architecture that allows structuring an application (desktop, web or


mobile application).

§ They are reproducible solutions to problems that commonly arise in software design.
2
§ System architecture is used to define:

§ Structure of the system (skeleton)


§ High-level components of a system,
§ Relationships between the system’s components and with
the environment and how they will all work together.

- Client-server - Layered architecture

- Peer-to-Peer - Three-tier architecture

- 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

1 - Data Access Layer


Data Management:
§ It represents the application's data and defines how it is structured and organized.
§ Thisincludes defining the data types, relationships, and any rules or constraints that
apply to the data.
Data Storage and Retrieval:
§ It manages the storage and retrieval of data from external sources, such as databases.
§ It handles tasks like querying databases, making API calls, and persisting data.
5
MODEL LAYER
Accessors (Getters and Setters):
§ It defines methods (getters and setters) that allow controlled access to the data.
§ Thisenforces a controlled way to read and modify the data, preventing unauthorized or
incorrect operations.

Encapsulation and Abstraction:


§ It encapsulatesthe data and operations related to the data, providing an abstraction that
hides the internal details from the other layers.
§ This helps in managing complexity and maintaining a clear and organized codebase.

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.

Independence from Views and Controllers:


§ Model layer operates independently of both the View and Control layers, ensuring a
clean separation of concerns.
§ This promotes code maintainability and reusability.
7
VIEW LAYER
The View layer serves as the user interface component responsible for presenting
information to the user and receiving user input. Its main roles and responsibilities include:

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.

User Interaction Handling:


§ It captures user input events, such as clicks, keystrokes, and gestures.
§ It passes the events to the Controller for processing.

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:

Handling User Input:


§ The Controller is responsible for capturing and interpreting user input from the View.

This includes events like clicks, keystrokes, and gestures.

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

perform and what view to return to the user.


10
11
§ A web application is based on a three-tier Client-Server architecture.

(Client / Web Server / Database Server).

12
§ Tier 1: Client is a web browser.

§ Tier 2: the web application (Model, View and the

Controller) is deployed on the web server.

§ Tier 3: the data base is stored and managed by a

database server.

13
Web Server

CLIENTS WEB APPLICATION

Web Layer Model Layer


Client HTTP
SGBD
Navigateur Controller

Business Logic Layer

Data Access
DataBase

Layer
Client HTTP
Mobile app View

Client SOAP Web Service


JAVA, PHP, .NET
14
1. The user sends an HTTP request to the web
server by clicking on a link or a button.
2. The controller receives the client's request.
3. The controller triggers the business logic
defined in the model that are associated with
this type of request.
4. The model performs the requested processing
and returns the results (data) to the controller.
5. The controller selects the web page
associated with this type of processing and
passes the data to it to be displayed (result of
the processing).
6. The web server construct the web page.
7. The HTTP response is transmitted to the
client's browser, which displays it as a web
page. 15

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy