MVC ARCHITECTURAL PATTERN
DEVELOPING PROCESS OVERVIEW
PROBLEM
SOLUTION
MVC
PATTERN?
ARCHITECTURE?
FRAMEWORK?
PATTERN
"Each pattern is a three-part rule, which expresses a relation between a certain context (design context), a certain system of forces which occurs repeatedly in that context (recurring design problem), and a certain software configurations which allows these forces to resolve themselves (solution)"
ARCHITECTURAL PATTERN
ARCHITECTURAL PATTERNS
MVC Pattern
-
Model: business logic & processing
-
View: user interface (UI)
-
Controller: navigation & input
MVP
(MODEL - VIEW - PRESENTER)
COMPONENTS
- The MODEL refers to the data and business functionality of the application.
- The VIEW is the visual representation of the MODEL and is comprised of the screens and widgets used within and application.
- The PRESENTER is a component which contains the presentation logic which interacts with the MODEL
THE SUPERVISING CONTROLLER
COMPONENTS
-
The VIEW is the visual components used within an application such as screens and widgets.
-
The CONTROLLER is a component which processes user events and the complex presentation logic within an application.
THE PASSIVE VIEW PATTERN
COMPONENTS
- The VIEW is the visual components used within an application such as screens and widgets.
- The CONTROLLER is a component which processes user events and the presentation logic within an application.
PRESENTATION - ABSTRACTION - CONTROL PATTERN
(PAC)
Description
Components
-
The abstraction component retrieves and processes the data.
-
The presentation component formats the visual and audio presentation of data.
-
The control component handles things such as the flow of control and communication between the other two components.
PRG
Post Redirect Get
Instead of returning a web page directly, the POST operation returns a redirection command. The HTTP 1.1 specification introduced the HTTP 303 ("See other") response code to ensure that in this situation, the web user's browser can safely refresh the server response without causing the initial HTTP POST request to be resubmitted.
AGILE & DESIGN PATTERN
SOLID PRINCIPLE
S : SRP (Single Responsibility Principle)
O : OCP (Open Close Principle)
L : LISKOV (Liskov Substitution Principle)
I : ISP (Interface Segregation Principle)
D : DI (Dependency Inversion)
SINGLE RESPONSIBILITY PRINCIPLE
Which is the single reponsibility of each class?
Single responsibility = single reason for change
A class should have one and only one reason to change
This class does too much. HELP!!
http://blog.gauffin.org/2011/07/single-responsibility-prinicple/
Easy way to follow SRP
OPEN CLOSE PRINCIPLE
Open for extension
Close for modification
How to achieve OCP?
Liskov Substitution Principle
If S is a subtype of T, then objects of type T may be replaced with objects of type S (i.e., objects of type S may substitute objects of type T) without altering any of the desirable properties of that program (correctness, task performed, etc.)
Solution
Clues fror LSP Violation
Interface Segregation Principle
No client should be forced to depend on methods it does not use. ISP splits interfaces which are very large into smaller and more specific ones so that clients will only have to know about the methods that are of interest to them.
Dependency Inversion
A. High-level modules should not depend on low-level modules. Both should depend on abstractions.
B. Abstractions should not depend on details. Details should depend on abstractions.
A GOOD architecture is a PLUGIN architecture.
MVC
ANTIPATTERNS
Circular Dependency
God Object
Object cesspool
Yo-yo problem
Magic Pushbutton
...
REST
Difference between traditional MVC and REST Controller
FINAL THOUGHTS
Title
MVC ARCHITECTURE
By Helbert Rico
MVC ARCHITECTURE
- 853