Студент : Наджа Аль Кузаи
Группа : 1372
(СПбГЭТУ «ЛЭТИ»)
MVC – Model , View , Controller
MVP – Model , View , Presenter
MVVM – Model , View , View Model
1
Software Architecture
Software architecture is a technical blueprint explaining how the
system will be structured
• The system architecture describes:
– How the system will be decomposed into subsystems (modules),
– Responsibilities of each module,
– Interaction between the modules,
– Platforms and technologies used,
• Each module could also implement a certain architectural model / pattern.
2
Multi-Tier Architecture
3
DB
ORM
WCF
ASP
.NET
HTML
The 3-Tier Architecture
• The 3-tier architecture consists of the following
tiers (layers):
– Front-end (client layer)
• Client software – provides the UI of the system
– Middle tier (business layer)
• Server software – provides the core system logic
• Implements the business processes / services
– Back-end (data layer)
• Manages the data of the system (database / cloud)
4
The 3-Tier Architecture Model
5
Business Logic
Desktop
Client
Mobile
Client
Client
Machine
Database
Data Tier
(Back-End)
Middle Tier
(Business Tier)
Client Tier (Front-End)
Typical Layers of the Middle Tier
• The middle tier usually has parts related to the
front-end, business logic and back-end:
6
Presentation Logic
Implements the UI of the application (HTML5, Silverlight, WPF, …)
Business Logic
Implements the core processes / services of the application
Data Access Logic
Implements the data access functionality (usually ORM framework)
MVC (Model-View-Controller)
What is MVC and How It Works?
7
Model-View-Controller (MVC)
• MVC is one of three ASP.NET programming models.
• MVC. Presented by Trygve Reenskaug in 1979
8
Model-View-Controller (MVC)
Model–view–controller (MVC) is a software design pattern
(architectural pattern) for implementing user interfaces . It
divides a software application into three interconnected
parts,
– Separates the business logic from application data and presentation:
• Model
– Keeps the application state (data)
• View
– Displays the data to the user (shows UI) , visible layer
• Controller
– Handles the interaction with the user , manages Views & user interaction
9
MVC- Environment
• .NET
– ASP.NET MVC, MonoRail
• Java
– JavaServer Faces (JSF), Struts, Spring Web MVC, Tapestry,
JBoss Seam, Swing
• PHP
– CakePHP, Symfony, Zend, Joomla, Yii, Mojavi
• Python
– Django, Zope Application Server, TurboGears
• Ruby on Rails
10
MVC
MySQL/ NoSQL/MongoDB
PHP / Rubby / Paython
Linux / Windows Server
HTML, Java Script/ CSS
Browser/firefox/Internet explorer
Client
Contains all storage
11
MVC-Based Frameworks
MODEL:
Adding & receiving items from DB
Processing Data from/to DB
Speaking only with controller
VIEW:
Only this that user sees.
Speaking only with controller
CONTROLLER:
Takes info from user.
Processes info & talks to DB if needed.
Receives info from DB.
Speaks to VIEW to explain presentation.
12
Model-View-Presenter (MVP)
13
MVP (Model-View-Presenter)
• Model-View-Presenter (MVP) is UI design pattern
similar to MVC
– Model
• Keeps application data (state)
– View
• Presentation – displays the UI and handles UI events (keyboard,
mouse, etc.)
– Presenter
• Presentation logic (prepares data taken from the model to be
displayed in certain format)
14
MVVM Model-View-ViewModel
• Model-View-ViewModel (MVVM) is architectural
pattern for modern UI development
Invented by Microsoft for use in WPF and Silverlight
Based on MVC, MVP and Martin Fowler's Presentation
Model pattern
Officially published in the Prism project (Composite
Application Guidance for WPF and Silverlight)
Separates the "view layer" (state and behavior) from the
rest of the application
15
MVVM Structure
• Model
– Keeps the application data / state representation
– E.g. data access layer or ORM framework
• View
– UI elements of the application
– Windows, forms, controls, fields, buttons, etc.
• ViewModel
– Data binder and converter that changes the Model
information into View information
– Exposes commands for binding in the Views.
16
MVVM Structure
MVVM is typically used in XAML applications (WPF,
Silverlight, WP7) and supports unit testing.
17
Comparison
MVC - Model View Controller
• The input is directed at the Controller first.
• Many-to-one relationship between the Controller and the View.
• One-to-one relationship from Controller to View.
• The Controller returns back to the Model, so there is knowledge between the View and the
expected Model being passed into it.
MVP – Model View Presenter
• The input begins with the View, not the Presenter.
• There is a one-to-one relationship between the View and the Presenter.
• The View holds a reference to the Presenter which is aware of the View its associated with.
• The Presenter updates the View based on the requested actions it performs on the Model, but the
View is not Model aware.
MVVM – Model View View Model
• The input begins with the View, not the View Model.
• While the View holds a reference to the View Model, the View Model has no information about the
View.
• One-to-many relationship between multiple Views and one View Model.
• For example, a WPF View and a Silverlight View could share the same View Model.
18
Вопросы
19
Спасибо за внимание
20

Software Design Patterns

  • 1.
    Студент : НаджаАль Кузаи Группа : 1372 (СПбГЭТУ «ЛЭТИ») MVC – Model , View , Controller MVP – Model , View , Presenter MVVM – Model , View , View Model 1
  • 2.
    Software Architecture Software architectureis a technical blueprint explaining how the system will be structured • The system architecture describes: – How the system will be decomposed into subsystems (modules), – Responsibilities of each module, – Interaction between the modules, – Platforms and technologies used, • Each module could also implement a certain architectural model / pattern. 2
  • 3.
  • 4.
    The 3-Tier Architecture •The 3-tier architecture consists of the following tiers (layers): – Front-end (client layer) • Client software – provides the UI of the system – Middle tier (business layer) • Server software – provides the core system logic • Implements the business processes / services – Back-end (data layer) • Manages the data of the system (database / cloud) 4
  • 5.
    The 3-Tier ArchitectureModel 5 Business Logic Desktop Client Mobile Client Client Machine Database Data Tier (Back-End) Middle Tier (Business Tier) Client Tier (Front-End)
  • 6.
    Typical Layers ofthe Middle Tier • The middle tier usually has parts related to the front-end, business logic and back-end: 6 Presentation Logic Implements the UI of the application (HTML5, Silverlight, WPF, …) Business Logic Implements the core processes / services of the application Data Access Logic Implements the data access functionality (usually ORM framework)
  • 7.
    MVC (Model-View-Controller) What isMVC and How It Works? 7
  • 8.
    Model-View-Controller (MVC) • MVCis one of three ASP.NET programming models. • MVC. Presented by Trygve Reenskaug in 1979 8
  • 9.
    Model-View-Controller (MVC) Model–view–controller (MVC)is a software design pattern (architectural pattern) for implementing user interfaces . It divides a software application into three interconnected parts, – Separates the business logic from application data and presentation: • Model – Keeps the application state (data) • View – Displays the data to the user (shows UI) , visible layer • Controller – Handles the interaction with the user , manages Views & user interaction 9
  • 10.
    MVC- Environment • .NET –ASP.NET MVC, MonoRail • Java – JavaServer Faces (JSF), Struts, Spring Web MVC, Tapestry, JBoss Seam, Swing • PHP – CakePHP, Symfony, Zend, Joomla, Yii, Mojavi • Python – Django, Zope Application Server, TurboGears • Ruby on Rails 10
  • 11.
    MVC MySQL/ NoSQL/MongoDB PHP /Rubby / Paython Linux / Windows Server HTML, Java Script/ CSS Browser/firefox/Internet explorer Client Contains all storage 11
  • 12.
    MVC-Based Frameworks MODEL: Adding &receiving items from DB Processing Data from/to DB Speaking only with controller VIEW: Only this that user sees. Speaking only with controller CONTROLLER: Takes info from user. Processes info & talks to DB if needed. Receives info from DB. Speaks to VIEW to explain presentation. 12
  • 13.
  • 14.
    MVP (Model-View-Presenter) • Model-View-Presenter(MVP) is UI design pattern similar to MVC – Model • Keeps application data (state) – View • Presentation – displays the UI and handles UI events (keyboard, mouse, etc.) – Presenter • Presentation logic (prepares data taken from the model to be displayed in certain format) 14
  • 15.
    MVVM Model-View-ViewModel • Model-View-ViewModel(MVVM) is architectural pattern for modern UI development Invented by Microsoft for use in WPF and Silverlight Based on MVC, MVP and Martin Fowler's Presentation Model pattern Officially published in the Prism project (Composite Application Guidance for WPF and Silverlight) Separates the "view layer" (state and behavior) from the rest of the application 15
  • 16.
    MVVM Structure • Model –Keeps the application data / state representation – E.g. data access layer or ORM framework • View – UI elements of the application – Windows, forms, controls, fields, buttons, etc. • ViewModel – Data binder and converter that changes the Model information into View information – Exposes commands for binding in the Views. 16
  • 17.
    MVVM Structure MVVM istypically used in XAML applications (WPF, Silverlight, WP7) and supports unit testing. 17
  • 18.
    Comparison MVC - ModelView Controller • The input is directed at the Controller first. • Many-to-one relationship between the Controller and the View. • One-to-one relationship from Controller to View. • The Controller returns back to the Model, so there is knowledge between the View and the expected Model being passed into it. MVP – Model View Presenter • The input begins with the View, not the Presenter. • There is a one-to-one relationship between the View and the Presenter. • The View holds a reference to the Presenter which is aware of the View its associated with. • The Presenter updates the View based on the requested actions it performs on the Model, but the View is not Model aware. MVVM – Model View View Model • The input begins with the View, not the View Model. • While the View holds a reference to the View Model, the View Model has no information about the View. • One-to-many relationship between multiple Views and one View Model. • For example, a WPF View and a Silverlight View could share the same View Model. 18
  • 19.
  • 20.