Tuesday, 5 February 2013

Sequence Diagram


  • Class Diagrams and Object Diagrams present static information
  • in a functioning system however objects interact with each other over time
  • A UML Sequence Diagram is used to show the details od these object interactions over time
    • Consider a washing machine system which consists of a number of objects including a water pipe, washing machine, drum and drain
    • What is the sequence of a actions performed once the clothes are added and a wash cycke started

  • Use Cases suggest how actors interact with the system that will ultimately to implemented in software
  • During this interaction, an actor will generate events to the system, requesting a particular operation in response
  • It is often desirable to isolate and document the operations that an actor requests of a system
  • A system sequence diagram is a drawing that shows for a particular use case scenario, the events, external actors generate their order and inter system events all against time.

Representing objects

  • squares with object type optionally proceeded by object name and colon
    • write object's name if it clarifies the diagram
    • object's "life line: represented by dashed vertical line

Messages between objects

  • message indicated by horizontal arrow to other objects
    • write message name and arguments above arrow
    • dashed arrow back indicates return messages

Lifetime of object

  • creation: arrow with new written above it
    • notice that an object created after the start of the scenario appears lower than the other
  • deletion an X at bottom of object's life line
    • Java does not explicitly delete objects, they fall out of scope and are garbage collected

Indicating method calls

  • activation: think box over object's life line drawn when object's method is on the stack
    • either that object is running its code, or it is on the stack waiting for another object's method to finish


2 comments:

  1. Very well explained, what is the software you used to draw these diagrams. I use creately to draw my uml diagrams and it has helped me to learn and create sequence diagrams better.

    ReplyDelete