Introducing Design Patterns Flashcards

1
Q

What are Design Patterns in software engineering?

A

Design patterns are reusable solutions to common software enginnering problems.

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

What are the benefits of using Design Patterns?

A

They help speed up development and improve code quality

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

What are the 3 categories of Gang Of Four Design Patterns?

A

Creational

Structural

Behavioural

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

What is a Creational Design Pattern?

A

One that deals with object creation

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

What is a Structural Design Pattern?

A

One that eases design by identifying simple ways of realizing relationships between objects

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

What is a Behavioural Design Pattern?

A

One that helps define how objects interact

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

What is the Creational Design Pattern known as Factory Pattern used for?

A

To encapsulate object creation logic making it easier to add new types of objects without modifying existing code.

Example: IAnimal interface and AnimalFactory

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

What is the Creational Design Pattern known as Singleton used for?

A

To ensure a class has only one instance and a global point of access to it.

Example: LogManager

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

What is the Structural Design Pattern known as Decorator used for?

A

Allows behaviour to be added to an object dynamically without affecting other objects of the same class.

Example: Reading/Writing file. Want to add in buffering, compression…

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

What is the Structural Design Pattern known as Facade used for?

A

Provides a simplified interface to complex systems

Example: A system that is accessing multiple API’s

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

What is the Behavioural Design Pattern known as Iterator used for?

A

A way to access elements of an objects sequentially without exposing it’s underlying representation.

Example: ICollection

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

What is the Behavioural Design Pattern known as Observer used for?

A

Defines a one-to-many dependency between objects so when one changes therest are notified and updated.

Example: BaggageInfo is object observed by screens, customer service etc

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

What category of the Gang Of Four Design Patterns is the **Repository **Pattern?

A

It isn’t!

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

Describe the use of the Repository Pattern?

A

Mediates between the domain and data layers using a collection like interface for accessing domain objects.

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

Which Design Pattern is commonly used with the Repository Pattern that ensures changes made to multiple objects in the application are either committed or rolled back?

A

Unit Of Work, which is a Behavioral Design Pattern

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