Design Patterns Flashcards

1
Q

Creational Design Patterns

A
  • all about creating objects while hiding creation logic

- flexibility to decide which objects to create for a use case

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

Abstract Factory

A

Creates an instance of several families of classes

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

Builder

A

Separates object construction from its representation

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

Factory Method

A

Creates an instance of several derived classes

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

Object Pool

A

Avoid expensive acquisition and release of resources by recycling objects that are no longer in use

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

Prototype

A

A fully initialized instance to be copied or cloned

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

Singleton

A

A class of which only a single instance can exist

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

Structural Design Patterns

A
  • all about class composition

- inheritance is used to compose interfaces and get new functionality

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

Adapter

A

Match interfaces of different classes

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

Bridge

A

Separates an object’s interface from its implementation

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

Composite

A

A tree structure of simple and composite objects

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

Decorator

A

Add responsibilities to objects dynamically

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

Facade

A

A single class that represents an entire subsystem

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

Flyweight

A

A fine-grained instance used for efficient sharing

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

Private Class Data

A

Restricts accessor/mutator access

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

Proxy

A

An object representing another object

17
Q

Behavioral Design Patterns

A

all about class communication

18
Q

Chain of responsibility

A

A way of passing a request between a chain of objects

19
Q

Command

A

Encapsulate a command request as an object

20
Q

Interpreter

A

A way to include language elements in a program

21
Q

Iterator

A

Sequentially access the elements of a collection

22
Q

Mediator

A

Defines simplified communication between classes

23
Q

Memento

A

Capture and restore an object’s internal state

24
Q

Null Object

A

Designed to act as a default value of an object

25
Observer
A way of notifying change to a number of classes
26
State
Alter an object's behavior when its state changes
27
Strategy
Encapsulates an algorithm inside a class
28
Template method
Defer the exact steps of an algorithm to a subclass
29
Visitor
Defines a new operation to a class without change
30
GoF
Gang of Four, solidified the concept of Design Patterns
31
GoF Principle: | Program to an ____ not an implementation.
interface
32
GoF Principle: | Program to an interface, not an _____.
implementation
33
GoF Principle: | Favor object _____ over inheritance.
composition
34
GoF Principle: | Favor object composition over _________.
inheritance