up previous next contents
Next: Collaboration and State Modeling Up: A sample process Previous: Robustness analysis   Contents

Subsections

Interaction modeling

Introduction

Current state:

  • Uncovered most problem space objects and assigned some attributes to them.
  • Defined some static relationships between these objects.
  • Defined a few dynamic relationships on robustness diagrams.

Interaction modeling is the phase in which you build the threads that weave your objects together and enable you to see how they will perform useful behavior. One of the primary tools of this task is creating sequence diagrams.

Objectives

Upon completion of this section, students will be able to:

  • Define the goals of interaction modeling.
  • Create sequence diagrams.
  • Put behavioral methods on your classes.
  • Update your static model.

Goals of Interaction Modeling

  • Allocate behavior among entity, boundary, and control objects.
  • Show detailed interactions that occur over time among objects.
  • Finalize the distribution of operations among classes.

Sequence Diagrams

  • Represent the major work product of our design.
  • Draw one sequence diagram that encompasses the basic course and all alternative courses within each of your use cases. One sequence diagram per use case.
  • These results form the core of your dynamic model.

Four Sequence Diagram Elements

  • The text for the course of action of the use case.
  • Objects.
  • Messages.
  • Methods (operations, behaviors).

Getting Started

Four steps to creating diagrams:

  • Copy the use case text to the left margin of the sequence diagram.
  • Add the entity objects.
  • Add the boundary objects.
  • Work through the controllers, one at a time. Determine how to allocate behavior between the collaborating objects.

Putting Methods on Classes

  • This is the essence of interaction modeling.
  • It's also hard.
  • A cow needs milking. Does the cow object milk itself, or does the Milk object "de-cow" itself?
  • Convert controllers from robustness diagrams to sets of methods and messages that embody the desired behavior.
  • An object should have a single "personality". Avoid schizophrenic objects.
  • If you have objects with split personalities you should use aggregation.
  • Use CRC cards to help.
  • Behavior allocation is of critical importance.
  • Don't show message parameters on your sequence diagrams.

Which Methods Belong With Objects

  • Reusability - the more general, the more reusable. Does this method make the class more or less reusable.
  • Applicability - is there a good fit between the object and method?
  • Complexity - is it easier to build a method in another object?
  • Implementation knowledge - does the implementation of the behavior depend on details internal to the associated method?

Completing Interaction Modeling

  • Drawn all needed sequence diagrams.
  • Updated your static model.
  • Last stop before you start coding; Critical Design Review is essential.


up previous next contents
Next: Collaboration and State Modeling Up: A sample process Previous: Robustness analysis   Contents