목록Software Design Pattern (19)
Moe's Tech Blog

Motivation Think of how a boss in a company uses memos to carry out tasks If the boss needed a worker to schedule a meeting, and also needed another worker to talk to an important client about business, the boss can use memos The boss is a very busy person and may not have time to remember which workers do what jobs and wont have time to walk to the different workers to ask them to complete the ..

Motivation Let's say instructor asks you to do a dance but remain in the same state (sitting, standing, laying down) If you are sitting down, your dance might involve you waving your arms and shoulders and bobbing head If you are standing, you would be able to add some foot works to your dance If you are laying down, you might throw your hands in the air and wiggle your body All the instructor t..

Motivation Think of requesting help on a health problem you try visiting your doctor first with your quest but your case is unusal, so you are referred to a specialist but the specialist is on leave and can't take your request and so you referred to another specialist finally, this specialist ends up dealing with your problem you don't care who along this chain of professionals help, but only th..

Behavioral Design Patterns focuses on ways that individuals objects collaborate to achieve a common goal each object you make is a piece of a larger solution in order for each to work effectively, it needs to have a set purpose e.g. each person working at a company if the people of the company didn't have any predefined roles, there would be no way to make sure that each of their functions was b..

Motivation In software, like devising a new beverage (by mixing multiple ingredients), it's beneficial to have flexible combinations of overall behaviors But, we encounter an issue trying to do this dynamically at runtime This means, a change cannot be made to classes while our program is running We need to create a new class in order to achieve a new combination of behaviors Given how there are..
Creational Pattern: Involve object instantiation and all provide a way to decouple a client from the object it needs to instantiate Structural Pattern: Let you compose classes or objects into larger structures Behavioral Pattern: is concerned with how classes and objects interact and distribute responsibility Pattern Type Name Use Cases Creational Singleton Prototype Factory Builder Structural F..

Motivation There are times when it's easier, safer, or more convinent to use a placeholder to represent something or something else Example 1. Individual representatives may be sent to sepak on behalf of company 2. Crash test dummies are used instead of real human beings 3. Credit card is used as a method of payment instead of cash All of the objects in the example are represented by a proxy obj..