Intro to Design Patterns - OOP Flashcards

1
Q

Software design pattern

A

Reusable patterns commonly used to solve problems. Usually describes how classes and functions are structured and used. Usually conceptual and language-agnostic.

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

What are Design Patterns?

A

Software design patterns are reusable patterns that usually guide how class and functions are structured and used.

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

Iterator

A

A class whose responsibility is to know how to iterate through an object.

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

Factory

A

A class or method whose responsibility is to create instances of some class.

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

Adapter

A

A class whose responsibility is to help two other classes communicate with each other.

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

Observer

A

A class whose responsibility is to watch for changes over many objects, and notify many objects when changes happen.

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

Decorator

A

A class or method whose responsibility is to dynamically alter and extend the behavior of a function or class.

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

Strategy

A

A class whose responsibility is to represent an algorithm.

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

How Do We Use design patterns?

A

Design patterns are applied when it makes problem-solving easier. It takes time, experience, research, context, and experimentation to apply design patterns effectively.
When considering a design pattern, the team should consider:

Does this make the code more or less maintainable over time?
What is the cost of implementing this design pattern?
What are the benefits of implementing this design pattern?
What are the alternatives?

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