Sequence Diagram Objects are represented horizontally across the top of the diagram The first object is typically an Actor, the one who initiates Each object has a lifeline some exist before and/or after some are created during some are destroyed during An active object is indicated by a narrow rectangle (on the activation stack) Time is represented vertically down the diagram. Time moves forward as you go downwards
Diagramming notation :sales4:sale > sale Items: ArrayList items[i]: item A list of objects from the class item One item of the list the class salenamed instance unnamed instance Multiobject – a collection :item
Sequence Diagram Numbering is not required to know the message sequencing
Sequence diagram A payment object is created, and therefore shown lower down in the time sequence
Focus of control The sale object is activated three different times The sale object sends a message to the register object - this activation is distinct from the initial activation of the register
Showing returns
Message to ‘this’
Destroying an object A destroyed object is explicitly shown with a large X at that point in its lifeline
Conditional message
Mutually exclusive conditional messages
Iteration
Iteration over a sequence of messages
Iteration over a multiobject In this case, the sale object is sending the getSubtotal message synchronously to each of its salesLineItems
Iteration over a collection 3 rd edition :Sale lineItems[i] :SalesLineItem t=getTotal() st = getSubTotal() [i<lineItems.size]Loop
Messages to a class itself, not an object
> Calendar :Foo Message to class Invoke a static method