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

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
主站蜘蛛池模板: 安丘市| 方山县| 永兴县| 招远市| 甘洛县| 瓦房店市| 宜州市| 织金县| 江口县| 日土县| 南部县| 边坝县| 鹤庆县| 蒙山县| 枣阳市| 青岛市| 正蓝旗| 元朗区| 凤庆县| 中方县| 古蔺县| 十堰市| 沁阳市| 安化县| 苍南县| 海原县| 保康县| 武强县| 惠水县| 丰镇市| 黄平县| 富阳市| 安西县| 溆浦县| 和平区| 平湖市| 扶绥县| 镶黄旗| 基隆市| 娄烦县| 安徽省|