Skip to content

Behavioral pattern

wikipedia Behavioral pattern

In software engineering, behavioral design patterns are design patterns that identify common communication patterns among objects. By doing so, these patterns increase flexibility in carrying out communication.

NOTE:

“behavioral pattern”即“行为模式”,它名称中的behavior,可以解释为:

  • strategy
  • algorithm
  • ......

behavior pattern告诉我们: 需要抽象出system中不同object之间的**common communication pattern**,一般使用interface来描述**common communication pattern**,其实这有些类似于design by contact(参见Theory\Design-pattern\Goal-and-principle\Principle\Design-by-contract.md)。

behavior pattern践行着如下原则:

  • program to interface
  • composition over inheritance