When to use differentts architectures Flashcards
When do you want to use the “Template method” architecture
When we want to execute a specific process whenever a task or tasks is performed
When do you want to use the “Chain of Responsibility” architecture
When we need a pipeline for a chain of objects for processing a request
When do you want to use the “Comand” architecture
When we want to record the actions or events of an application
When do you want to use the “Finite state machine (FSM)” architecture
Is used to give us the liberty to break down a large complex task into a chain of independent smaller tasks
When do you want to use the “Memento pattern” architecture
Is used to implement UNDO machanism in applications
When do you want to use the “Decorator pattern” architecture
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.
When do you want to use the “bridge pattern” architecture
When you want multiple objects that do the same thing but in different ways ( may be wrong understanding so look through).
When do you want to use the “Singleton” architecture
When multiple objects want to talkt tothe same instance of an object to a class. Provides a global acces point to an object.
When do you want to use the “Observer” architecture
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.
When do you want to use the “Object Pool” architecture
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
When do you want to use the “Publish Subscribe” architecture
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.
When do you want to use the “Proxy pattern” architecture
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.
When do you want to use the “Prototype pattern” architecture
When creating a new object you want to copy an existing object
When do you want to use the “Builder pattern” architecture
- 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.