Model View Controller Architectural Design Pattern

Download Report

Transcript Model View Controller Architectural Design Pattern

Model View
Controller
Architectural
Design Pattern
Typically divided into 2 layers,
similar to the Layered Architecture
Pattern:
Top Layer : User Interface (Front End)
Controller
uses
View
Bottom Layer : System Data & Logic (Back End)
Model
One way communication:
Model-View-Controller Static Structure
uses
Controller
modifies
Signals
View
Signals
Retrieves
and
displays
Model
Dynamic Variant
Advantages

Views and controllers can be modified, added, and removed
without destroying the model.

Make design for the user interface simple and organized.
Advantages

Keeping View and Control separate makes it simple to change View
without changing how the user can interact with the program.

The UI can be altered during run time simply by changing and
replacing the views and controllers.
Advantages

Separation of Data from presentation


MVC enforces separation
Multiple Views & Deals with changes

MVC provides a way to have multiple views that rely on one model and
in todays world we are always creating applications that can be
accessed in more than one way.

Views and controllers can be added without messing up the model
since components are nearly decoupled.
Advantages

Can be used with any interface since it returns data without
applying any format

Clarity of design


Looking at models public methods helps to understand how the models
behavior works and makes the program easier to implement and
maintain.
Efficient modularity of design allows components to be swapped
Disadvantages


General

Old, lots of newer variations (MVP, MVA, etc)

More applicable for programs with GUIs

Overkill on smaller projects
Complexity


More code to write
Changeability

The architecture is well-specified, making deviations difficult
Disadvantages

Cohesion


Cohesion is low because the different components have different goals
Coupling

Carries a high risk of coupling (based on implementation)

Views and Model, for example

Controller needs to collaborate with the other two, risk there as well.