Last Lectures ♦ Use Case Model Detailled use case - Important Use case diagram- Refactoring Use case diagram <<Include>> <<Extend>> 1 Last Lectures ♦ DOMAIN Model • Conceptual classes ( object , events , idea …etc) • Attributes Data value of an object. To remember information • Associations Relationship between conceptual classes • Multiplicities many instances can be validly associated with another instance 2 What we did !!! Sample UP Artifact Relationships Domain Model Sale Business Modeling Sales LineItem 1..* 1 date . . . . . . . . . quantity Vision Use-Case Model Process Sale Process Sale use case names Cashier Requirements Use Case Diagram 1. Customer arrives ... 2. Cashier makes new sale. 3. ... parameters and return value details Use Case Text Glossary system events : System Operation: enterItem(…) Post-conditions: - . . . : Cashier system operations make NewSale() Supplementary Specification enterItem (id, quantity) System Sequence Diagrams Operation Contracts starting events to design for : Register Design Design Model : ProductCatalog enterItem (itemID, quantity) spec = getProductSpec( itemID ) addLineItem( spec, quantity ) : Sale System Sequence Diagrams Chapter 10 Applying UML and Patterns -Craig Larman Introduction Class diagrams represent static modeling. What about modeling dynamic behavior? Interaction diagrams (Sequence and communication diagrams) model how groups of object collaborate to perform some behavior Typically captures the behavior of a single use case Today´s lecture System Sequence Diagram (SSD) For a use case scenario, an SSD shows: The System (as a black box) :System The external actors that interact with System The System events that the actors generate , their temporal order. How to construct an SSD from a use case System Sequence Diagrams ♦ Draw a line representing the system as a black box. ♦ Identify each actor that directly operates on the system. Draw a line for each such actor. ♦ From detailled (expanded) use case identify system events that each actor generates. Illustrate them ♦ Optionally include use case text on left. 8 Relationship SSD and Use case Develop SSDs for the main success scenario of a selected use case, then frequent alternative scenarios Process Sale system as black box the name could be "NextGenPOS" but "System" keeps it simple the ":" and underline imply an instance, and are explained in a later chapter on sequence diagram notation in the UML external actor to system Process Sale Scenario :System : Cashier makeNewSale a UML loop interaction frame, with a boolean guard expression loop [ more items ] enterItem(itemID, quantity) description, total endSale return value(s) associated with the previous message an abstraction that ignores presentation and medium the return line is optional if nothing is returned total with taxes makePayment(amount) change due, receipt a message with parameters it is an abstraction representing the system event of entering the payment data by some mechanism Relationship between SSD and Use case Naming System events & operations System events and associated system operations should be expressed at the level of intent. Rather than physical input medium or UI widget Start operation names with verb (from use case) Which is better, scanBarCode or enterItem? Naming System events & operations Capture the intent of the operation while remaining abstract :System : Cashier better name enterItem(itemID, quantity) scan(itemID, quantity) worse name SSDs and the Glossary in parallel Why is updating the glossary important when developing the SSD? New terms used in SSDs may need explanation, especially if they are not derived from use cases A glossary is less formal, easier to maintain and more intuitive to discuss with external parties such as customers Why Draw SSD? Actually , we investigate the behaviour of the system as black box (what system do). It is Important to know events that are coming in our system Later during design , the software is designed to handle these events In design , we will open the black box and look on how object collaborate to achieve what should be done Example 1 16 Example 2 17 Question please!! 18