When to use differentts architectures Flashcards

1
Q

When do you want to use the “Template method” architecture

A

When we want to execute a specific process whenever a task or tasks is performed

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

When do you want to use the “Chain of Responsibility” architecture

A

When we need a pipeline for a chain of objects for processing a request

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

When do you want to use the “Comand” architecture

A

When we want to record the actions or events of an application

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

When do you want to use the “Finite state machine (FSM)” architecture

A

Is used to give us the liberty to break down a large complex task into a chain of independent smaller tasks

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

When do you want to use the “Memento pattern” architecture

A

Is used to implement UNDO machanism in applications

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

When do you want to use the “Decorator pattern” architecture

A

When you want to apply differnet changes to data like storing it, compressing it, or encrypting it but you might only want to do 2 out 3 of the task. Then you only decorate the data with for instance the enryption and then storing task.

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

When do you want to use the “bridge pattern” architecture

A

When you want multiple objects that do the same thing but in different ways ( may be wrong understanding so look through).

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

When do you want to use the “Singleton” architecture

A

When multiple objects want to talkt tothe same instance of an object to a class. Provides a global acces point to an object.

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

When do you want to use the “Observer” architecture

A

When changes to the state of one object may require changing
other objects, and the actual set of objects is unknown beforehand
or changes dynamically

OR

When some objects in your app must observe others, but only for a
limited time or in specific cases.

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

When do you want to use the “Object Pool” architecture

A

When creating an instance of an object is resource heavy object pooling creates multiple ones puts them in a “pool” and they are ready for use later on

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

When do you want to use the “Publish Subscribe” architecture

A

is used when you have a scenario where publishers send messages to a specific topic or channel, and subscribers interested in that topic receive the messages. It is a messaging pattern that enables loose coupling and asynchronous communication between components.

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

When do you want to use the “Proxy pattern” architecture

A

When you want to provide a surrogate or placeholder for another object to control access to it. The proxy pattern allows you to add an extra layer of indirection to provide additional functionality or control over the underlying object without modifying its core implementation.

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

When do you want to use the “Prototype pattern” architecture

A

When creating a new object you want to copy an existing object

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

When do you want to use the “Builder pattern” architecture

A
  • Pattern suggest that the object construction code is extracted from the class and
    placed in other objects “builders” (example CarBuilder).
  • Pattern organize object construction into several steps (to create an object you
    execute a series of steps on a builder object).
  • Do not need to call all the steps, just the steps that are necessary for producing a
    particular configuration of an object.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly