2/20 - Software Architecture Flashcards
1
Q
Model View Controller (MVC) Architecture
A
- A method for separating the user interface of an application from its domain logic.
- UI and domain logic have different drivers for change and rates of change.
2
Q
The Model
A
- The model is the functional core of the application
- Encapsulates the state of the application
- Model is independent of the GUI
- Active Model
- Passive Model
3
Q
Functional core of the application
A
- Business logic
2. Domain logic
4
Q
Business logic
A
business layer in enterprise applications
5
Q
Domain logic
A
domain-specific logic
6
Q
The State of the application
A
- Example: databases
- Invariants (e.g. a transaction in a zero-sum operation)
- If model is correct the data will continue to make sense
7
Q
Model is independent of the GUI
A
- It cannot direct references to the view or controller
- This gives it flexibility, testability and robustness
- Model can be tested using automated controller and machine checkable views
8
Q
Active Model
A
- Defines a change notification mechanism that view and controller can subscribe to
- Common in desktop GUI apps
9
Q
Passive Model
A
- Model is called by view and controller to get data
* Common in web UI
10
Q
The View
A
- What data to show and how to present it based on the state of the model
- View informs the controller of user actions
- View has access to the model but should not change the model
- For web apps, view contains HTML + Javascript
11
Q
The Controller
A
- View deals with output, Controller deals with input
- Controller decides what model actions are needed, selects the next view and allows user to drive the app
- In web apps, controller will be handler for incoming HTTP requests
12
Q
Pros of MVC
A
- Allows to separate and modularize concerns. Leads to ease of development, testing and maintenance
- Separation between data layer and interface is the key
13
Q
Why is separation between data layer and interface key?
A
- View is easily replaced or expanded
- Model data changes are reflected in views
- Better scalability
- Distribution over network is greatly simplified
14
Q
Cons of MVC
A
- View and Controller depend heavily on model API
- Close coupling between view and controller
- Additional complexity
15
Q
Architectural Configurations
A
Arrangements of components and connectors to form an architecture