Software Architecture and Design Patterns Flashcards

(20 cards)

1
Q

What are design patterns?

A

Reusable solutions to common coding problems (like blueprints for software).

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

Why use design patterns?

A
  1. Save time 2. Improve team communication 3. Make code easier to maintain.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are creational patterns?

A

Patterns for creating objects (e.g., Singleton, Factory).

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

What does the Singleton pattern do?

A

Ensures only ONE instance of a class exists (e.g., a settings manager).

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

How is a Singleton implemented?

A
  1. Private constructor 2. Static instance 3. getInstance() method.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are structural patterns?

A

Patterns for organizing classes/objects (e.g., Adapter, Decorator).

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

What are behavioral patterns?

A

Patterns for object communication (e.g., Observer, Strategy).

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

What is MVC?

A

Model-View-Controller: splits app into data (Model), UI (View), and logic (Controller).

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

What does the Model do in MVC?

A

Manages data (e.g., bank account balances, product inventory).

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

What does the View do in MVC?

A

Displays data to users (e.g., balance screen, product catalog).

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

What does the Controller do in MVC?

A

Handles user input and updates Model/View (e.g., processes payments).

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

Why separate Model/View/Controller?

A

Easier to update one part without breaking others (e.g., change UI without touching data logic).

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

How does MVC help testing?

A

Each part can be tested alone (e.g., test Model math without UI).

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

What’s the flow in MVC?

A

User → Controller → Model → View → User (like a loop).

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

What should NEVER talk directly in MVC?

A

View and Model (Controller must mediate all communication).

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

How to spot MVC in code?

A

Look for classes named *Model, *View, *Controller (e.g., CartModel, CartView).

17
Q

What’s a passive View?

A

View only shows data - no logic (Controller tells it what to display).

18
Q

What’s the Singleton’s global access point?

A

getInstance() method (always returns the same object).

19
Q

When to use MVC?

A

For complex apps needing clean separation (e.g., banking, e-commerce).

20
Q

What’s the key MVC rule?

A

Controller owns the flow; Model and View are ‘dumb’ workers.