creational
-
PrototypeModeling/DesignPattern 2020. 2. 26. 00:41
1. Overview We have a complex object that is costly to create. To create more instances of such class, we use an existing instance as our prototype. Prototype will allow us to make copies of the existing objects and save us from having to recreate objects from scratch. 2. Description 2.1 Implementation Prototype class must implement Cloneable interface Prototype Class should override the clone m..
-
BuilderModeling/DesignPattern 2020. 2. 24. 22:00
1. Overview The intent of the Builder design pattern is to separate the construction of a complex object from its representation. We have a complex process to construct an object involving multiple steps, then the builder design pattern can help us. In builder, we remove the logic related to object construction from client code and abstract it in separate classes. 2. Description 2.1 Motivation 2..
-
Categorizing Design PatternModeling/DesignPattern 2019. 9. 29. 17:32
1. Overview Design patterns are solutions to software design problems you find again and again in real-world application development. Patterns are about reusable designs and interactions of objects. The 23 Gang of Four (GoF) patterns are generally considered the foundation for all other patterns. They are categorized into three groups: Creational, Structural, and Behavioral 2. Description 2.1 Cr..
-
Factory PatternModeling/DesignPattern 2019. 8. 22. 09:17
1. Overview The factory method pattern is a creational pattern that uses factory methods to deal with the problem of creating objects without having to specify the exact class of the object that will be created. This is done by creating objects by calling a factory method—either specified in an interface and implemented by child classes, or implemented in a base class and optionally overridden b..
-
Simple Factory PatternModeling/DesignPattern 2019. 8. 22. 09:16
1. Overview 2. Description 2.1 Motivation Here we simply move the instantiation logic to a separate class and most commonly to a static method of this class Some do not consider a simple factory to be a design pattern, as its simply a method that encapsulates object instantiation. Nothing complex goes on in that method. Typically we want to do this if we have more than one option when instantiat..