system sequence diagrams
play

System Sequence Diagrams relationships Behavior can be specified in - PDF document

Specifying required behavior using the UML Class models describe objects and their System Sequence Diagrams relationships Behavior can be specified in terms of operation and Contracts and Contracts pre and postconditions, but behavior


  1. Specifying required behavior using the UML  Class models describe objects and their System Sequence Diagrams relationships  Behavior can be specified in terms of operation and Contracts and Contracts pre and postconditions, but behavior is not the primary focus of a class model primary focus of a class model  Behavioral models at the requirements Eunjee Song level Computer Science Department  Interaction models: describe interactions between actors and the system Baylor University  Contracts: Specify operations invoked by actors. Eunjee Song SSDs and Contracts-1 Eunjee Song SSDs and Contracts2 S a m p le U P A rtifac t R elatio ns h ip s Still doing... Requirements Analysis D o m ain M od e l S a le s B u s in e s s S ale 1 1 .. * . . . M o d e lin g L in e Ite m d a te . . . . . . q u a ntity V isio n U se -C a s e M o d el P ro ce ss S a le  Focusing on the WHAT not the HOW P roce ss use S ale 1 . C u sto m e r ca se a rrive s ... C a shie r n a m e s 2 . C a sh ie r m a ke s ne w  System sequence diagrams and how sa le . 3 . ... G lo ssa ry p a ra m eters an d R e q uire - U se C a se D ia gram U se C a se T e xt re tu rn va lue d e ta ils m e n ts they relate to use cases system e ve n ts : S y s te m : S y s te m O p e ra tio n: : C ash ier m ak e S u pp le m e n ta ry en te rIte m (… ) syste m N e w S a le () S p e cificatio n o p eratio ns P o st-con d itio n s: en te rIte m - . . . (id , qu a n tity ) O p e ra tio n C o n tra c ts S y s te m S e q ue n c e D ia g ra m s sta rtin g e ven ts to d e sig n fo r D e sign M o d e l : R e g ister : P ro d u ctC atalog : S a le e n te rIte m (ite m ID , q u a n tity) D e s ig n sp e c = g e tP ro d u ctS p e c ( item ID ) a dd L in e Ite m ( sp e c, q u a n tity ) Eunjee Song Eunjee Song SSDs and Contracts3 SSDs and Contracts4 System Sequence diagrams SSD Example system as black box the name could be "NextGenPOS" but "System" keeps it simple  Describes in more detail a scenario in a the ":" and underline imply an instance, and are explained in a later chapter on sequence diagram notation in the UML use case external actor to Process Sale Scenario system  Created from the text of the use case : Cashier :System makeNewSale  A kind of UML sequence diagram a UML loop loop [ more items ] interaction interaction enterItem(itemID quantity) enterItem(itemID, quantity)  SSD is a simplified version of SD frame , with a boolean guard expression description, total useful for requirements analysis  a message with  More general version of sequence diagrams: endSale parameters return value(s) associated with the later, when talking about design it is an abstraction total with taxes previous message representing the system event of an abstraction that entering the makePayment(amount)  Example: Process Sale for POS system ignores presentation payment data by and medium some mechanism the return line is change due, receipt optional if nothing is returned Eunjee Song Eunjee Song SSDs and Contracts5 SSDs and Contracts6 1

  2. Elements of SSD Different Kinds of Arrows  Actors Synchronous flow: e.g., Procedure call  UML notation for an object  System events  Cashier generates makeNewSale , enterItem , and endSale system events Asynchronous flow  (Optional) information from the system back to the actors  item description, running total, etc. Return Eunjee Song SSDs and Contracts7 Eunjee Song SSDs and Contracts8 SSDs and Use Cases for “ Process Sale ” SSD for “ Process Sale (cont)  System presents total with taxes. To Process Sale Scenario determine taxes, System uses an external Tax :System : Cashier Calculator. makeNewSale Simple cash-only Process Sale scenario: loop [ more items ] 1. Customer arrives at a POS checkout enterItem(itemID, quantity) with goods and/or services to purchase. 2. Cashier starts a new sale. 3. Cashier enters item identifier. description total description, total 4. System records sale line item and 4 S d l li i d presents item description, price, and running total. Cashier repeats steps 3 - 4 until indicates done. endSale 5. System presents total with taxes calculated. 6. Cashier tells Customer the total, and total with taxes asks for payment. 7. Customer pays and System handles payment. makePayment(amount) ... change due, receipt Eunjee Song Eunjee Song SSDs and Contracts9 SSDs and Contracts10 SSD for “ Process Sale (cont) Payment SSDs  Cashier enters cash amount tendered, and « a ctor» :NextGenPOS «actor» :CreditAuthorization System :Accounts System presents change due :Customer Service makeCreditPayment  System presents receipt (credNum, expiryDate) reply = requestApproval( request )  System logs completed sale and sends postReceivable( receivable ) sale info to the external Accounting sale info to the external Accounting postSale( sale ) system and to the external Inventory system Eunjee Song Eunjee Song SSDs and Contracts11 SSDs and Contracts12 2

  3. Abstractions in SSDs SSD Sketches  Events and return values are abstractions  Independent of mechanism & representation  makePayment(amount)  Shows input info  Looks like a method call, but is really an abstraction of an event  Name: should capture the intent  Avoid specifying implementation choices  enterItem(itemID) is better than scan(itemID)  . Eunjee Song SSDs and Contracts13 Eunjee Song SSDs and Contracts14 Contracts Timeline for SSDs Process Sale Scenario :System  SSDs are created during elaboration : Cashier makeNewSale()  Clarify the major events that the system should be able to handle loop [ more items ] enterItem(itemID, quantity) these input system events invoke system operations  Later we design objects to handle these the system event enterItem events (object-oriented design) events (object oriented design) description, total invokes a system operation called enterItem and so forth  SSDs are created for some chosen this is the same as in object- oriented programming when endSale() we say the message foo scenarios from the current iteration invokes the method (handling operation) foo total with taxes  Happy path + frequent/complex makePayment(amount) alternatives. change due, receipt Eunjee Song Eunjee Song SSDs and Contracts15 SSDs and Contracts16 Contract Examples Contract Definition  Stand-alone system  A system operation is a behavior that is invoked by  No external inventory system a user  Adding items to the inventory  A contract specifies a system operation in terms of pre- and postconditions  An instance of Item is created  Precondition: what must be true about concepts  The new instance is associated with the  The new instance is associated with the represented in the domain model before the start of the represented in the domain model before the start of the operation Store  Postcondition: what must be true about concepts  Removing items from the inventory represented in the domain model after the operation has ended  The association is destroyed and the Item Include instances created or deleted, new attribute values,  links created or deleted instance is also destroyed Eunjee Song Eunjee Song SSDs and Contracts17 SSDs and Contracts18 3

  4. Records-sale-of Product Ledger Product Description Catalog Contains itemID 1 1.. * description 1 1 price 1 Records- 0..1 Used-by Describes accounts- * for * Sales Store LineItem Item Stocks name quantity 1 1 * 1..* address 1.. * 1 Contained-in Houses Logs- completed 1.. * 1 * Sale Register Captured-on dateTime id 1 0..1 / total 1 1 1 1 Works-on Is-for Paid-by 1 1 1 CashPayment Customer Cashier amountTendered id Eunjee Song SSDs and Contracts19 Contract Example 1 - makeNewSale Operation : makeNewSale() Cross References : Use Case – Process Sale Precondition : An authenticated cashier c is Precondition : An authenticated cashier, c , is logged-in at a Register, r . Postcondition :  A Sale instance, s , was created;  Attributes of s were initialized.  s was associated with r .  s was associated with r Eunjee Song SSDs and Contracts20 1

  5. Contract Example 2 - enterItem Operation : enterItem(itemID:ItemID, quantity:integer) Cross References : Use Case – Process Sale Cross References : Use Case Process Sale Precondition : current sale object, s, exists Postcondition :  A SalesLineItem instance, sli, was created;  sli was associated with s  sli.quantity = quantity  sli quantity = quantity  sli was associated with a ProductDescription, based on itemID match Eunjee Song SSDs and Contracts21 Records-sale-of Product Ledger Product Description Catalog Contains itemID 1 1.. * description 1 1 price 1 Records- 0..1 Used-by Contract Example - enterItem Describes accounts- * for * Sales Store LineItem Precondition : current sale object, s, Item Stocks name quantity 1 1 * 1..* exists address 1.. * 1 Contained-in Logs- Houses Postcondition : completed 1.. * 1 *  A SalesLineItem instance, sli, was Sale Register Captured-on created; dateTime id 1 0..1 / total 1 1  sli was associated with s 1 1  Works-on Is-for Paid-by  sli.quantity = quantity 1 1 1 CashPayment Customer Cashier  sli was associated with an Item, based amountTendered id on itemID match Eunjee Song SSDs and Contracts22 2

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend