Lecture 3-System architecture 2 Flashcards
What is the Model-View-Controller (MVC) used for?
Widely used for many object-oriented designs involving user interaction.
*part of the basic of the Smalltalk programming environment
What are the 3 parts of MVC?
-Model –> application domain
-View –> display of the application’s state
-Controller –> user interaction with the model and the view
What are the 3 responsibilities of the Model?
-Manages the behaviour and data of application domain
-Responds to requests for info about its state(usually from the view)
-Responds to instructions to change state(usually from the controller)
What are the 2 responsibilities of the View?
-It renders the contents of a portion of the model’s data for visualization or interaction.
-If model data changes, the view MUST update its representation as needed using:
–push model :view registers itself with the model for change notifications (observer pattern)
–pull model: view calls model when it needs to update data
What does the Controller do?
It translates the user’s interactions + view with it into actions that the model will perform.
What are the 4 MVC interactions?
1.The model objects are created –> (each object is part of business model)
2.The views register as observes on the model objects–> model does not know that view or controller exist. it just sends notifications to all observers.
3.The controller is bound to a view–> (any action made by user through view will invoke a method in the controller class)
4.The controller is given a reference to the underlying model–> (when controller method is called, it triggers model’s functions/ state change)
What is the MVC-I?
It’s a simple version of MVC architecture where the system is decomposed into two sub-systems :
-Controller-View
-Model
What does the sub-system Controller-View do(2)?
-It takes care of input and output processing and their interfaces
-Registers with(attaches to) the data module
What does the sub-system Model do?
It copes with all core functionality and the data
What is the relationship between the 2 sub-systems?
The Controller-View is an observer of the data in the Model module
Explain MVC vs Layered architecture(IA) for Dependency
MVC –> flow control is often bidirectional
LA–> flow control is unidirectional (each layer depends on layer under)
Explain MVC vs Layered architecture(IA) for Responsibilities
MVC–> Model, View, Controller
LA–> Presentation, business logic , data access layer
Explain MVC vs Layered architecture(IA) for Use cases
MVC–> often used in web, GUI desktop and some mobile apps
LA–>large scale enterprise apps