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

Introducing behavioral design patterns

In Chapter 1, Unified Modeling Language Primer, we learned that behavioral diagrams illustrate how system components interact to form a system. We examined the following behavioral diagrams—activity diagram, interaction diagram, state Machine diagram, and use case diagram. It follows that behavioral design patterns are focused on the interaction of objects and classes in a system. The key component here is the interaction, also referred to as the communication between objects and classes.

The twelve behavioral design patterns presented in this chapter can be grouped into two subcategories—those that focus on classes and those that focus on objects. The following table details the subcategories:

Behavioral design pattern subcategories

The behavioral design patterns listed in the preceding table are detailed in the remaining sections of this chapter. They are presented in alphabetical order to illustrate that one is not more important than the others. Here is a brief description of each design pattern's applicability to the behavioral design category. These are further detailed in subsequent sections of this chapter:

  • Chain of responsibility pattern: An object submits a request to multiple objects without knowing which object will handle the request
  • Command pattern: Permits the sending of requests without knowing details about the receiver or even about what is being requested
  • Interpreter pattern: Used to establish a grammatical representation and an interpreter that interprets language
  • Iterator pattern: Grants access to an object's members without sharing the encapsulated data structures
  • Mediator pattern: Used to permit object interactions without using explicit object references
  • Memento pattern: Saves an object's current internal state as a memento so that it can be referred to and restored to
  • Null object pattern: Negates the need to search for the null condition
  • Observer pattern: Updates subscriber objects when a change is made to the publisher object's state
  • State pattern: Allows an object to change its behavior based on internal state changes
  • Strategy pattern: Allows us to individually encapsulate a set of interchangeable algorithms
  • Template method pattern: Involves creating an algorithm template with processing steps relegated to child classes
  • Visitor pattern: Performs operations on an object without altering its structure
主站蜘蛛池模板: 扎兰屯市| 河北区| 曲松县| 白朗县| 阳高县| 睢宁县| 莆田市| 三台县| 潜山县| 青河县| 大理市| 湖州市| 宜兴市| 民勤县| 巴南区| 抚宁县| 靖州| 南溪县| 芮城县| 扎赉特旗| 乾安县| 柳江县| 广丰县| 深水埗区| 安泽县| 清苑县| 涞水县| 若尔盖县| 绥棱县| 西青区| 大渡口区| 故城县| 大竹县| 敦煌市| 海门市| 铜鼓县| 阳江市| 长宁县| 雷波县| 平山县| 灵宝市|