Selecting the Right Diagram

The dynamic nature of the application domain can be viewed via the four diagrams just described: the two interaction diagrams (sequence and collaboration), the state diagram, and the activity diagram. When should you use which one?

  1. Sequence diagram: Use this diagram for most dynamic modeling because it pertains to the use-case pathways. The big payback here is the creation of the operational signatures for the classes in the application.

  2. Collaboration diagram: Use this diagram when the application includes complex branching dialogs that aren't rendered well in the sequence diagram. (I rarely produce collaboration diagrams, instead opting for the more familiar and more orderly sequence diagram.) Collaboration diagrams are also good for multithreaded scenarios.

  3. State diagram: This diagram is useful only for a class that exhibits interesting and complex dynamic behavior. In real-time applications (e.g., embedded systems), the ratio of state diagrams to classes will be higher than in non-real-time applications. However, the exact number will depend on the nature of the application. Most applications do not need state diagrams. (The entity classes are usually uninteresting regarding state. Usually if I produce state diagrams, they are for control and boundary classes.)

  4. Activity diagram: This diagram can clearly depict a complex workflow. Activity diagrams are easy to read and very understandable to the business community. (I use them a lot during use-case definitions. They sometimes produce a clearer picture than a verbal outline format in a use-case template.)

The sequence diagram is the most commonly used; the other three are used only as needed.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.139.240.119