MVC Flashcards

(24 cards)

1
Q

What is MVC?

A

MVC is an architectural design pattern that divides an application into three main components:
Model(manages the core data and business logic),
View(responsible for displaying data to the user),
Controller (handles user input, updates the Model, and refreshes the View).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Components & Responsibilities: Model

A

Represents application data and state (e.g., account balances, transaction history). Enforces business rules and maintains data consistency. Notifies the View of data changes to update the display.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Components & Responsibilities: View

A

Presents data from the Model visually. Reacts to changes in Model by updating the user interface. Does not contain business logic; purely a presentation layer.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Components & Responsibilities: Controller

A

Acts as a mediator between Model and View. Processes user inputs (e.g., button clicks, form submissions). Updates Model based on inputs and coordinates updates to the View.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Core Principles: Separation of Concerns

A

Each component focuses on a distinct responsibility to reduce code overlap and complexity.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Core Principles: Modularity and Maintainability

A

Changes in one component (e.g., Model) don’t directly affect others, enabling easier updates and extensions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Core Principles: Scalability

A

New features can be added by extending Models, Views, and Controllers without disrupting existing code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Core Principles: Flexibility

A

Supports multiple user interfaces (e.g., mobile, desktop) sharing the same Model but with different Views.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Core Principles: Testability

A

Components can be tested independently (Model logic, Controller input handling, View display), improving reliability.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Terminology and Relationships: Model-View Relationship

A

View observes Model changes but does not modify data directly.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Terminology and Relationships: Controller-Model Relationship

A

Controller interacts with Model to apply business logic and update data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Terminology and Relationships: Controller-View Relationship

A

Controller updates View to reflect Model changes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Terminology and Relationships: No direct View-Model interaction

A

Communication is typically through Controller to keep components decoupled.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Terminology and Relationships: Passive View

A

The View is passive and driven by the Controller, meaning it does not contain logic for data manipulation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Example Context (Banking App): Model

A

Stores account details, transaction history.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Example Context (Banking App): View

A

Displays dashboards, transaction lists.

17
Q

Example Context (Banking App): Controller

A

Handles user actions like money transfers, updating balances.

18
Q

UML Application Notes: Classes

A

Separate classes clearly into Model, View, and Controller in class diagrams.

19
Q

UML Application Notes: Methods

A

Align methods between sequence diagrams and class diagrams for clarity.

20
Q

UML Application Notes: Naming

A

Use clear method naming to reflect Controller responsibilities (e.g., initiateTransfer(), validateTransfer()).

21
Q

UML Application Notes: Responsibilities

A

The Controller orchestrates the flow, Models handle data, Views display information.

22
Q

Final Notes: MVC nature

A

MVC is a guideline rather than strict rules, adaptable per project needs.

23
Q

Final Notes: Focus

A

Focuses on improving maintainability, testability, and scalability through clear role separation.

24
Q

Final Notes: Variants

A

Variants of MVC exist due to its evolution over time.