Chapter 6 - Design Patterns Flashcards

1
Q

Design patterns

A

descriptions of communicating objects and classes that are customized to solve a general design problem in a particular context

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

design for change

A

when designing a system we should also plan for inevitable changes.

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

Creational

A

patterns proposing flexible solutions for creating objects. They include Abstract Factory (6.2), Factory Method, Singleton (6.3), Builder (6.12), and Prototype.

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

Structural

A

patterns proposing flexible solutions for composing classes and objects. They include Proxy (6.4), Adapter (6.5), Facade (6.6), Decorator (6.7), Bridge, Composite, and Flyweight.

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

Behavioral

A

patterns proposing flexible solutions for interaction and division of responsibilities among classes and objects. They include Strategy (6.8), Observer (6.9), Template Method (6.10), Visitor (6.11), Chain of Responsibility, Command, Interpreter, Iterator (6.12), Mediator, Memento, and State.

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

Singleton

A

This design pattern ensures that a class, as the name suggests, has at most one instance

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

Factory

A

(1) creates and returns objects of a particular class; and (2) hides the type of these objects behind an interface

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

Proxy

A

advocates the use of an intermediary object, also known as a proxy, between a base object and its clients

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

stubs

A

facilitate remote communication.

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

Adapter

A

This pattern is recommended when we need to convert one class interface into another.

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

Facade

A

a class that offers a simplified interface to a complex system. The objective is to shield users from the need to understand the internal classes of this system.

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

Decorator

A

Instead of using inheritance, it employs composition to dynamically add these functionalities to base objects.

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

Strategy

A

aims to parameterize the algorithms used by a class, encapsulating a family of algorithms and making them interchangeable

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

Observer

A

defines a way to implement a one-to-many relationship between subject and observer objects. When the state of a subject changes, all its observers are notified.

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

Template Method

A

specifies how to implement the template of an algorithm in an abstract class, which we’ll call X, while deferring some steps or methods for implementation in the subclasses of X. In summary, a Template Method allows subclasses to customize an algorithm without changing its fundamental structure, which is defined in the base class

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

double dispatch

A

the types of the target object and one argument are used to determine the method that will be invoked. (only available in a few languages)

17
Q

Visitor

A

This pattern provides a way to add an operation to a family of objects without modifying the classes themselves.

Designed to function effectively even in languages with single dispatching, such as Java.

18
Q

Iterator

A

a design pattern that standardizes an interface for traversing a data structure

19
Q

Builder

A

a design pattern that simplifies the instantiation of objects with several attributes, some of which may be optional

20
Q

patternitis

A

an inflammation associated with the premature or excessive use of design patterns