Design Patterns Flashcards

1
Q

What is the relationship between refactoring and design patterns?

A

We can REFACTOR TOWARDS a design pattern (not necessarily match)

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

What are the 3 groups of design patterns?

A

Behavioural
Structural
Creational

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

Which design pattern allows an object to change its behaviour based on it’s internal state?

A

the state pattern

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

Which design pattern allows an object to change how it performs a task?

A

the strategy pattern

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

What does the factory design pattern refer to?

A

A CLASS who’s job is to CREATE objects

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

What does the singleton design pattern refer to?

A

A CLASS that only has ONE INSTANCE with a GLOBAL POINT OF ACCESS

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

What does the adapter design pattern refer to?

A

Convert one interface into ANOTHER using a WRAPPER CLASS

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

Which design pattern refers to composing a tree structure of objects? Benefit?

A

The composite design pattern, It allows the client to use an individual part (object) and the whole composition (tree) in the same way

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