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

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.

主站蜘蛛池模板: 农安县| 米林县| 兰州市| 新巴尔虎左旗| 镇康县| 修文县| 阆中市| 桂平市| 保康县| 栾川县| 安图县| 清水县| 方山县| 灵丘县| 襄汾县| 洛扎县| 浦城县| 锡林浩特市| 皋兰县| 南通市| 华池县| 铜陵市| 道孚县| 清苑县| 临澧县| 建始县| 台安县| 梓潼县| 达尔| 休宁县| 通化市| 凭祥市| 黑河市| 乌什县| 游戏| 奉新县| 榆树市| 科尔| 屏东市| 大化| 黔西|