System Design Patterns Flashcards

1
Q

WHat can be represented by a class?

A
  • real-world, external entities
  • information entities
  • abstract ‘metahpors’ and ideas
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the 3 main design principles to aim for?

A
  • Distribtuion of behaviours (decentralisation)
  • Even granularit (components to have similar levels of complexity)
  • Loose coupling (objects can be reused in another context)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Briefly describe CRC Card prototyping

A

+ low tech strategy for prototyping useful object concepts

+ flexible; allows the concept set to change

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

How do we write a CRC card? 3 steps

A
  • Name concept accroding to main purpose
  • Identify (up to 7) responsibilities: knowing, doing, enforcing (physical size constraints force decomposition)
  • Identify collaborators (classes on which this one depend)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What do we put on the reverse side of a CRC card?

A
  • categorise the card
  • attributes (no remote get/set methods)
  • constraints (business rules for attributes)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are 3 ways to split a CRC card?

A
  • 2 peer concepts; if responsibilties handle disjoint subset of attributes or collaborators.
  • Parent-child concepts; if some responsibilties handle a subset of attributes or collaborators
  • Subcontractor concepts; no obvious splitting move
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Why focus on responsibilty for Responsibilty-Driven Design?

A

want to identfy objects which bear some responsibility for the system

  • better than passive records which ancapsulate data
  • better than abstract data types with just set/get methods
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are 3 methods of Transformation to reorganise communication-paths between subsystems?

A
  • Delegation
  • Encapsulation
  • Refactoring
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is a design pattern?

A

reusable element of object oriented design

ready made solution to common design problems

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

Describe 3 typical uses of design pattern

A
  • look out for problems in design; apply pattern
  • design from scratch using patterns to get high-quality design
  • retrofit extensions/adaptionsusing patterns
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Describe the Bridge design pattern

A

reducing a number of specialised variants of a concept by encapsulating one varying dimension inside another

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

Describe the Mediator design pattern

A

introduce objects which handle communication between other objects
- removes need to couple objects directly

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

Describe the Chain of Responsibilty design pattern

A

give multiple objects the chance to handle a request

pass request along the chain

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

Describe the Command design pattern

A

encapsulate a funciton as an object with a single execture method, to add functions to a system incrementally

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

Describe the State design pattern

A

allows an object to alter its behaviour when its internal state changes

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

Describe the Template Method design pattern

A

generalise control algorithms to common skeleton code with dynamically bound subroutines

17
Q

WHat problem does the abstract factory design pattern solve?

A

dependency among components

18
Q

What are the benefits of having the mediator pattern?

A

good for uncoupling, simplifying communication paths

19
Q

What design patterns indicate loose coupling?

A

Mediator, composite

20
Q

What patterns indicate generic behaviour?

A

Command, template method, state, factory method

21
Q

What patterns indiciate late design fixes?

A

Observer, Facade, Adapter

22
Q

What are the benefits of having the command pattern?

A

indiciates modular system with extensible behaviour

23
Q

what are the benefits of have the template method pattern?

A

indicates reusable basis for algorithmic design

24
Q

What are the benefits of having the chain of responsibilty pattern?

A

indicates devolved responsibilty (single purpose objects)