Design Pattern - Creational Flashcards

1
Q

Abstract Factory

A

Works around a super-factory which creates other factories. This factory is also called a factory of factories. It is an interface that is responsible for creating a factory of related objects without explicitly specifying their classes. Each generated factory can give the objects as per the Factory pattern.

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

Builder

A

Builds a complex object using simple objects and using a step-by-step approach. This builder is independent of other objects.

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

Factory Method

A

One of the most used design patterns in Java. Create objects without exposing the creation logic to the client and refer to the newly created object using a common interface.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
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
5
Q

Prototype

A

Refers to creating duplicate objects while keeping performance in mind. Involves implementing a prototype interface which tells to create a clone of the current object. This pattern is used when the creation of an object directly is costly. For example, an object is to be created after a costly database operation. We can cache the object, returns its clone on the next request, and update the database as and when needed thus reducing database calls.

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

Singleton

A

A single class responsible for creating an object while making sure that only a single object gets created. This class provides a way to access its only object which can be accessed directly without the need to instantiate the object of the class.

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