Design Patterns and Principles Chapter 2 Flashcards

1
Q

____ _____ ____ in python focus on HOW objects are created and managed, ensuring flexibility, efficiency, and maintainability in your code.
They provide a structured approach to object instantiation, making it easier to control the creation process and decouple the creation logic from the rest of you application.

A

Creational Design Pattern

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

Creational Design Pattern(s) (SFABP)

A

Singleton
Factory Method
Abstract Factory
Builder
Prototype

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

One of the simplest design patterns: it involves only ONE CLASS which is responsible to MAKE SURE THERE IS NO MORE THAN ONE INSTANCE; it does it by instantiating itself and in the same time it provides a GLOBAL POINT OF ACCESS to that instance.

A

Singleton

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

Ensure that only one instance of a class is created and provide access point to the object

A

Singleton

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

The most used design pattern in modern programming languages like Java and C#. It comes in different variants and implementation

A

Factory Method

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

Defines an interface for creating objects, but let subclasses to decide which class to instantiate and Refers to the newly created object through a common interface.
Creates OBJ w/o exposing INST Logic to client
Ref to newly created OBJ thru COMMON INTERFACE

A

FACTORY MODE

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

A pattern that provides an interface for creating families of related or dependent object without specifying their concrete classes.

A

Abstract factory

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

To avoid adding code to existing classes and to support encapsulation, with this pattern a framework is defined, which produces objects that follow a general pattern and at runtime this facotry is paired with any concrete factory to produce objects that follow the pattern of a certain country
A super-factory which creates other factories(Factory of factories)

A

Abstract FACTORY

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

Defines an instance of creating an object but letting subclasses decide which class to instantiate and allows a finer control over the construction process.
Defines an instance for creating an object but letting subclasses decide which class to instantiate
Refers to the newly created object through a common interface

A

Builder

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

allows an object to create customized objects without knowing their class or any details of how to create them.

A

Prototype

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

Specify the kinds of objects to create using a prototypical instance, and create new objects by copying this prototype
Lets you copy existing objects without making your code dependent on their classes
Useful when object creation is constly

A

Prototype

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

are a subset of design pattern in software development that focus on the composition of classes or objects to form a larger, more complex structures

A

Structural Design Pattern

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

Structural Design Patter(s)(ABCDFPF)

A

Adapter
Bridge
Composite
Decorator
Flyweight
Proxy
Facade

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

A structural design pattern, it allows you to make TWO INCOMPATIBLE interfaces WORK TOGETHER by creating a bridge between them
Use when you need to make incompatible interface work

A

Adapter

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

The intent of this pattern is to DECOUPLE ABSTRACTION from implementation so that the two can vary INDEPENDENTLY.
Use when you want to separate an abstraction from its implementation

A

Bridge

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

The intent of this pattern is to COMPOSE objects into TREE STURCTURES to represent part-whole hierarchies.

A

Composite

17
Q

Lets client treat individual objects and composition of objects uniformly.
Useful when you need to treat individual objects and composition uniformly

A

Composite

18
Q

Extending an object’s functionality can be done ______
(at compile time) by using inheritance

A

statically

19
Q

However, it might be necessary to extend an object’s
functionality _______(at runtime) as an object is
used.

A

dynamically

20
Q

Allows to add behavior to individual objects, either statically or dynamically, without affecting the behavior of other objects from the same class.
useful when you need to add responsibilities to objects dynamically

A

Decorator

21
Q

A structural design pattern that allwos program to efficiently share many objects by minimizing memory usage

A

Flyweight

21
Q

Provide to create a substitue for an object, which can act as an intermediary or control access to the real object.
The intent of this pattern is to provide a placeholder for an object to control references to it
Useful wehn you need to control access to an object, or defer its full cost

A

Proxy

22
Q

Provides a simple interface to a complex subsystem which contains lots of moving parts. Its handy when you need to integrate your app with a sophisticated library that has dozen of features, but you just need a tiny bit of its functionality.

A

FACADE