Sequence Diagrams

Behavioural / Dynamic diagram

Useful for describing lifetimes and interactions between objects
How objects change & communicate with each other
Does not describe the whole system, just one particular part of it
Useful for when something’s not understood

 

Important to note that these diagrams are not meant to show the whole system or all possible conditions to the Nth iteration
They offer an overview of the important aspects, not a model of the whole system

interaction between a few objects

 

  1. Start with N objects at top
    1. Named as per their instantiation
    2. To use class name, put it on the RHS of a colon
      1. instance name : class name
    3. If just class name, just : class name
  2. Insert vertical dotted time lines
  3. Then represent the messages between the objects
  4. Customer wants to checkout
  5. Cart creatNewOrder
  6. Cart adds different items addItem(item, quantity) using parameters
  7. Solid arrows with full head represent a regular message
  8. Dotted arrows with stick head represent a response itemTotal
  9. Don’t need to write return messages, only when they add value
  10. Solid boxes are called activation bxoes / method call boxes, represent processing being carried out in response to messages
  11. If message/response happens multiple times, they are surrounded by a frame, Loop, all items
  12. calcuateDiscount
  13. finaliseSale, leads to some processing in the order object, which send a total back to the customer
  14. Customer submitPayment
  15. Since we having nothing to take care of payment, we can show that the Order object is going to initiate a message that’s going to create a new Payment object
  16. Payment object sends back results (success or fail) then ends it’s lifeline as indicated with a large cross X
  17. results are sent back to Customer

 

This level of diagramming is useful for sitting down with a business user / customer, since they are not technical diagrams and are meant as a thinking tool

 

N sequence diags could be developed, but not required for all scenarios

 

They provide help with situations that aren’t clear, and might result in new classes being identified

Leave a Reply