
上QQ阅读APP看书,第一时间看更新
Creational design patterns
The creational patterns intend to advocate a better way of creating objects or classes, and its primary focuses are as follows:
- Abstracting the class instantiation process
- Defining ways to create, compose, and represent objects and hide the implementation details from the involving system
- Emphasizing avoiding hard code of a fixed set of behaviors and defining a smaller set of core behaviors instead, which can compose into any number of (complex) sets
Creational design patterns have two basic characteristics: one is that they encapsulate knowledge about which concrete class the system use, and the second is that they hide how the instances of these classes are created and put together.
The class creational pattern uses inheritance for instantiation, whereas object creations delegates it to another object.
The following section deals with each pattern, its general structure, and sample implementation diagram in most of the cases.