Work & Programming/System Design 21

[Structural Pattern] - Flyweight

https://refactoring.guru/design-patterns/flyweight Flyweight/ Design Patterns / Structural Patterns Flyweight Also known as: Cache Intent Flyweight is a structural design pattern that lets you fit more objects into the available amount of RAM by sharing common parts of state between multiple objects instead of keeprefactoring.guru 자원의 효율적 사용을 위해 특정 키를 부여하고 이 키를 통해 자원을 캐싱 하고자 할때. 예시  - TextureCac..

[Structural Pattern] - Facade

https://refactoring.guru/design-patterns/facade FacadeIntent Facade is a structural design pattern that provides a simplified interface to a library, a framework, or any other complex set of classes. Problem Imagine that you must make your code work with a broad set of objects that belong to a sophisticatedrefactoring.guru 하나의 객체가 다른 여러개의 객체의 조합으로 이루어 지고, 이를 통해 관련 구현을 하고자 할 때.  => 작은 모듈로 구성된 대부분..

[Structural Pattern] - Decorator

https://refactoring.guru/design-patterns/decorator Decorator/ Design Patterns / Structural Patterns Decorator Also known as: Wrapper Intent Decorator is a structural design pattern that lets you attach new behaviors to objects by placing these objects inside special wrapper objects that contain the behaviors. Probrefactoring.guru  특정 기본 행위 위에 별도로 특정 행위를 추가적으로 하고자 할 때 사용.예시  - Lobby Card Renderer..

[Structural Pattern] - Composite

https://refactoring.guru/design-patterns/composite Composite/ Design Patterns / Structural Patterns Composite Also known as: Object Tree Intent Composite is a structural design pattern that lets you compose objects into tree structures and then work with these structures as if they were individual objects. Problemrefactoring.guru 어떤 특정 객체가 같은 객체를 재귀적으로 목록으로 가질 수 있는 경우를 표현할 때. 예시  - Dialog System..

[Structural Pattern] - Adapter

https://refactoring.guru/design-patterns/adapter Adapter/ Design Patterns / Structural Patterns Adapter Also known as: Wrapper Intent Adapter is a structural design pattern that allows objects with incompatible interfaces to collaborate. Problem Imagine that you’re creating a stock market monitoring app. Therefactoring.guru 서로 다른 두개의 객체의 interface를 보완하여 사용하게 해 줌. 예시 - XMLData : XMLTOJsonAdapter ..

[Creational Pattern] - Singleton

https://refactoring.guru/design-patterns/singleton SingletonReal-World Analogy The government is an excellent example of the Singleton pattern. A country can have only one official government. Regardless of the personal identities of the individuals who form governments, the title, “The Government of X”, is a grefactoring.guru 프로그램 life cycle안에서 유일한 객체 생성을 목표로 할 때 사용.  예 - 각종 manager class.  특징 ..

[Creational Pattern] - Builder

https://refactoring.guru/design-patterns/builder BuilderSay you have a constructor with ten optional parameters. Calling such a beast is very inconvenient; therefore, you overload the constructor and create several shorter versions with fewer parameters. These constructors still refer to the main one, passing srefactoring.guru 특정 단계가 필요한 절차대로 생성되는 어떤 대상들에 대해 각 상황에 걸맞는 생성코드 제작. 어떤 특정 제작단계가 반드시 정의..

[Creational Pattern] - Abstract Factory

https://refactoring.guru/design-patterns/abstract-factory Abstract FactorySolution The first thing the Abstract Factory pattern suggests is to explicitly declare interfaces for each distinct product of the product family (e.g., chair, sofa or coffee table). Then you can make all variants of products follow those interfaces. Forrefactoring.guru 특정 상황에 걸맞는 특정 object의 생성을 관련 factory 확장을 통하여 구현하고자 할..

[Structural Patterns] 특징과 사용례.

Adapter ; AuthenticateAdaptor 플랫폼간 인증 인자가 다를 때, 내부 서버에 내부 포맷으로 최종적으로 정리해서 보낼 무언가가 있어야 한다. 그때 adaptor를 사용하여 정리 작업을 진행한다. 특정 수정/변화를 특정 클래스로 한정시킨다. Bridge Adaptor와 거이 유사한 경우에 사용하나, Adaptor는 보다 기존 모듈간 연결시, Bridge는 개발해 나가는 특정 모듈에 대해 주로 사용하는 듯 보인다. Composite ; UIComposite 특정 객체가 다시 같은 객체를 재귀적으로 품을 수 있는 경우, 해당 객체 관리를 위해 사용한다. Decorator ; GameCardViewer - 카드를 먼저 그리고, 데이터에 따라 추가적으로 Hot, Vertical 등의 아이콘을 ..

[Creational Patterns] 특징과 사용례.

Factory Method ; ResolutionSolver ; AuthticationProvider ; MonsterProvider 객체 생성 주도를 외부에서 입력받는 객체에 의지하게 한다. 새로운 타입 추가 시 추가되는 타입에 대해서만 최소한의 코드가 추가된다. Pool ; SymbolCreator ; ParticleGenerator 많은 수의 프로토타입을 먼저 만들어서 풀을 만들고 그 풀안의 객체를 재사용한다. 메모리 재할당 방지. 캐시메모리 낭비 방지. Prototype ; HeroProvider ; MonsterProvider 미리특정 객체를 만들어 놓고, 생성요청이 발생하면 처음부터 다시 만드는게 아닌, 만든 객체를 복사하여 돌려준다. Builder ; PizzaBuilder ; Worldbu..