13. Sequence diagram example

The example below show some of the elements in a sequence diagram. It depicts a system that retrieves a bank balance given an account number.

UML sequence diagram example

The first thing to notice is the header 'sd Retrieve Balance (int accountNumber) : int' surrounded by the clipped rectangle. The two letter sd indicates that this is a sequence diagram. Other descriptors are 'ad' for an activity diagram and 'uc' for an use case diagram. The parameter is an integer and the return value is an integer.

The objects are lined up horizontally along the diagram. The sequence occurs vertically.

As a list of events the following happens

  • A getBalance call is made to the myBank object, this includes an account number parameter.
  • The myBank object then calls the ledger object with getAccNumber
  • The ledger objects responds by returning an internal account number
  • The myBank object then calls the accnt object with that internal number
  • The accnt object returns the balance to the myBank object
  • The myBank object then returns the balance to the actor that called the Retreive Balance service

You can see that the sequence diagram is a much more elegant way of presenting sequence rather than a mundane list.

 

Challenge see if you can find out one extra fact on this topic that we haven't already told you

Click on this link: UML sequence diagram

 

 

 

Copyright © www.teach-ict.com