Presentation is loading. Please wait.

Presentation is loading. Please wait.

Sequence Diagram Objects are represented horizontally across the top of the diagram Each object has a lifeline some exist before and/or after some are.

Similar presentations


Presentation on theme: "Sequence Diagram Objects are represented horizontally across the top of the diagram Each object has a lifeline some exist before and/or after some are."— Presentation transcript:

1 Sequence Diagram Objects are represented horizontally across the top of the diagram 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 Focus of control Time is represented vertically down the diagram. Time moves forward as you go downwards Iteration is shown with a frame

2 Sequence Diagram Message types Synchronous Asynchronous Creation Reply Reading: See sections 9.1, 9.2, 9.3, 9.4.1-9.4.4, 9.5 pages 178-182

3 Diagramming notation :sale s4:sale A sale object named s4 An unnamed sale object s4 An object named s4 Sale The class Sale

4 : register: sale : payment makePayment() payment() sd Make payment Sequence Diagram named Make payment Object is created

5 X : register: sale : payment makePayment() payment() sd Make Payment Object is destroyed

6 Message to ‘self’ A reflexive message : sale calcTotal() getTotal()

7 Iteration :Sale :SalesLineItem t=getTotal() st = getSubTotal() loop [I < numItems] loop is one of the keywords you can use to specify the nature of the fragment Note page 167 and use of alt

8 e.g. Singleton pattern Suppose CarMatchOffice works according to the Singleton Pattern. This means there must be at any time, at most, one instance of CarMatchOffice. The getInstance operation returns the single instance of the class. getInstance will create the instance if it does not already exist. > CarMatchOffice instance getInstance()

9 clientCarMatchOffice getInstance() alt Figure 17-21. Behaviour in Singleton Pattern :CarMatchOffice CarMatchOffice() Inst=CarMatchOffice() getInstance() [inst == null] [else] getAddress() When you ask for the instance of CarMatchOffice, there are two ways it can complete.

10 Examples 9.1-9.8 pages 179-182 Discusses construction of a sequence diagram Problem: create a sequence diagram to model the messages that occur when a Journey is created Figure 9-43 shows a diagram with CarSharer, Address, Journey, … Figure 6-11 shows the relationship of Address to Location Example 9-8 shows a scenario where the addresses are geolocated. Note that geolocate() is a method that manages this.

11 Use Case: Process Sale … Main Success Scenario 1.Customer arrives at POS checkout with goods and/or services to purchase 2.Cashier starts a new sale 3.Cashier enters item identifier 4.System records sale line item and presents item description, price, and running total. Price calculated from a set of price rules. Cashier repeats steps 3-4 until indicates done. 5.System presents total with taxes calculated 6.Cashier tells customer the total, and asks for payment. 7.Customer pays and System handles payment 8.System logs completed sale and sends sale and payment information to the external Accounting System and Inventory System. 9.System presents receipt 10.Customer leaves with receipt and goods Assignment 2: Q1: Construct a sequence diagram for a use case

12 :cashier:System


Download ppt "Sequence Diagram Objects are represented horizontally across the top of the diagram Each object has a lifeline some exist before and/or after some are."

Similar presentations


Ads by Google