官术网_书友最值得收藏!

Classifying patterns

The book by GoF on design patterns spoke about 23 design patterns and classified them under three main categories:

  • Creational patterns
  • Structural patterns
  • Behavioral patterns

The classification of patterns is done based primarily on how the objects get created, how classes and objects are structured in a software application, and also covers the way objects interact among themselves. Let's talk about each of the categories in detail in this section.

Creational patterns:

The following are the properties of Creational patterns:

  • They work on the basis of how objects can be created
  • They isolate the details of object creation
  • Code is independent of the type of object to be created

An example of a creational pattern is the Singleton pattern.

Structural patterns

The following are the properties of Structural patterns:

  • They design the structure of objects and classes so that they can compose to achieve larger results
  • The focus is on simplifying the structure and identifying the relationship between classes and objects
  • They focus on class inheritance and composition

An example of a behavior pattern is the Adapter pattern.

Behavioral patterns

The following are the properties of Behavioral patterns:

  • They are concerned with the interaction among objects and responsibility of objects
  • Objects should be able to interact and still be loosely coupled

An example of a behavioral pattern is the Observer pattern.

主站蜘蛛池模板: 曲松县| 化隆| 百色市| 汝南县| 丹东市| 成安县| 柏乡县| 塔河县| 渑池县| 宽城| 潞城市| 大洼县| 高尔夫| 黑龙江省| 台南市| 阿巴嘎旗| 加查县| 章丘市| 延长县| 翼城县| 通州市| 文山县| 金平| 宿松县| 当雄县| 东明县| 安乡县| 新龙县| 荃湾区| 凤城市| 北宁市| 旬邑县| 甘孜| 碌曲县| 石景山区| 永靖县| 民和| 和田县| 淳安县| 江陵县| 盖州市|