Presentation is loading. Please wait.

Presentation is loading. Please wait.

Use Cases and Object Interaction CS 123/CS 231. Depicting System Behavior zFirst, identify the use cases ÕUse case: typical interaction between a user.

Similar presentations


Presentation on theme: "Use Cases and Object Interaction CS 123/CS 231. Depicting System Behavior zFirst, identify the use cases ÕUse case: typical interaction between a user."— Presentation transcript:

1 Use Cases and Object Interaction CS 123/CS 231

2 Depicting System Behavior zFirst, identify the use cases ÕUse case: typical interaction between a user and the system zUse Case Diagram ÕDepicts all use cases for a system zInteraction Diagram ÕDepicts a single use case as a collection of interacting objects

3 Example: Use Case Diagram Facilitate Checkout Facilitate Return Search for Book LIBRARY SYSTEM Borrower Librarian

4 Use Case Diagram Notation zStick Figures – Actors ÕCould be a human user or a subsystem zEllipses - Use Cases zLinks - between actors and use cases zLinks between use cases Õ >: to depict inclusion of a use case Õ >: to depict variations of a general use case

5 Example: > Facilitate Checkout Facilitate Return Librarian Log-in > Note: UML v.1.3 uses > instead of >

6 Example: > Search for Book query Borrower By Author By Subject > Note: query is called an extension point

7 Describing a Use Case zNarrative ÕLibrary example (Facilitate Checkout): Given a borrower’s ID Card and the book to be borrowed, the librarian enters the borrower’s ID number and the book’s catalogue number. If the borrower is allowed to check out the book, the system displays that the book has been recorded as borrowed zOr, an Interaction Diagram

8 Example: Interaction Diagram Checkout Screen :Borrower :Book 1: checkIfDelinquent() 3: borrowBook() 2: checkIfAvailable() 4: setBorrower()

9 Interaction (Collaboration) Diagram Notation zRectangles: Classes/Objects zArrows: Messages/Method Calls zLabels on Arrows Õsequence number (whole numbers or X.X.X notation) Õmethod name (the message passed) Õmore details, if helpful and necessary (iterators, conditions, parameters, types, return types)

10 Methods zInteraction Diagrams suggest/imply methods for classes ÕHas consequences on detailed class diagram zThe label(s) of an arrow should be a method of the class the arrow points to zLibrary System ÕBorrower class should have at least two methods (checkIfDelinquent and borrowBook)

11 Including Conditions and Types Checkout Screen r:Borrower b:Book 1: delinq = checkIfDelinquent():boolean 3:[!delinq & avail] borrowBook(Book b) 2: avail = checkIfAvailable():boolean

12 Creating an Object znew means a constructor is being called ÕImplies object creation :Customer :CustomerList 1: addCustomer(custdetails) :Encoder 2: new Note: this means the addCustomer method will contain code that creates a Customer object

13 Iteration z* is an iterator Õmeans the method is called repeatedly :Branch :Store 1: printSalesSummary() :Manager 2: * getTotalSales() Note: Store needs data from all branches to produce a summary

14 Summary zProvide a Use Case Diagram to depict the use cases of a system zFor each use case, describe and provide an Interaction Diagram ÕDepict use case as a collection of interacting objects zOther diagramming techniques that aid in building a dynamic model: ÕState diagram: describes object state changes ÕActivity diagram: describes method behavior


Download ppt "Use Cases and Object Interaction CS 123/CS 231. Depicting System Behavior zFirst, identify the use cases ÕUse case: typical interaction between a user."

Similar presentations


Ads by Google