Modeling behavior of objects - interaction and state diagrams.

Objectives
  1. Modeling behavior based on interactions (cooperations) between objects. Drawing sequence diagram (SEQD) for selected use case. Switching between sequence diagram and dual collaboration diagram (COLD).
  2. Modeling behavior based on changing of states of objects.
Introduction
    Behaviour of objects needed for realization of specified use cases is based on collaborations of objects - communications between them and/or on changes of their states. Collaboration between objects can be established on interactions - sending, receiving and processing of messages.
Steps
  1. Write scenario for each use case in the use case model. Use each scenario for searching all objects needed for this scenario realization. Each from these objects will have their time line of living in interaction diagram - sequence diagram (SEQD).
    Fig.: Objects and their time lines in SEQD
    Task: Create new SEQD for specified use case in USCD. Insert all needed objects and their time lines in USCD.
    Analyze collaborations between objects in time of realization specified use case. Each collaboration needs communication - interchange of messages between objects. Reaction on received message can be some operation on the side of receiver (operation realized by receiver). This operation can be defined with use of member function of classes (methods). Describe all messages in SEQD with use of name of message (id of message) and content (arguments). Choice suitable operation from list of member functions of class (all needed such functions have to be previously defined in classes).
    Comment: Some CASE systems add all used operation in SEQD automaticly into classes in CLAD. Usage of operations in SEQD in PowerDesigner needs previously defined operations in classes. View/Redisplay from main menu of PowerDesigner can be used for showing names of called functions related to messages in SEQD and defined in like member functions in classes.
    Identify who/what (object) is sender and who/what (object) is receiver of this message. Important is time sequence of messages, time flow from top to down in SEQD.
    Fig.: Messages between objects in SEQD
    Task: Draw oriented links between objects representing sending of messages in SEQD for specified use case in USCD. Specify id and arguments for each message in SEQD.
    Another view of behaviour of objects is based on modeling of communications between objects (collaborations) - collaborations can be modeled by collaboration diagram (COLD) or communication diagram (COMD). If we have already created SEQD, it is possible change view from SEQD to dual COMD.
    Comment: Tools/Create Default Communication Diagram from main menu of PowerDesigner can be used for showing related COMD to SEQD.
    Fig.: Communications (collaborations) between objects
    Task: Switch from SEQD to COLD. Explain all collaborations in this model.
  2. Find classes with objects which are characterized with several states in their life cycles. Each state of object differs from other states by different values of state variables and by different ability to react on events.
    Task: Try find and characterize different states of objects for selected class in class diagram.
    Modeling of states for critical objects in modeled system can formally describe behaviour of these objects.
    Task: Draw state transition diagram (STAD) for selected class..
Resources
  1. Use case diagram http://www.tutorialspoint.com/uml/uml_class_diagram.htm
  2. PowerDesigner v12.5 Business Process Model. On-line Help System.
  3. FSE course, DCI FEEI TUKE, Kosice. Theme 6 - L06a UML - behavioral models https://moodle.fei.tuke.sk/mod/resource/view.php?id=4614
  4. FSE course, DCI FEEI TUKE, Kosice. Theme 6 - L06b UML - behavioral models - states and activities https://moodle.fei.tuke.sk/mod/resource/view.php?id=4615
Additional tasks
    Task: Create sequence diagrams for all use cases for example UnivLib project.
    Task: Create state diagram for objects from class copy of the book
comments powered by Disqus