1 / 46

Object-Oriented Analysis & Design

Object-Oriented Analysis & Design. Dr. M.E. Fayad, Professor Computer Engineering Department – RM# College of Engineering San José State University One Washington Square San José, CA 95192-0180 URL: http://www.cmpe.sjsu.edu/~fayad. Lesson 12: Use Case Modeling. 2. Lesson Objectives.

Albert_Lan
Download Presentation

Object-Oriented Analysis & Design

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Object-Oriented Analysis & Design Dr. M.E. Fayad, Professor Computer Engineering Department – RM# College of Engineering San José State University One Washington Square San José, CA 95192-0180 URL: http://www.cmpe.sjsu.edu/~fayad SJSU -- CmpE

  2. Lesson 12: Use Case Modeling 2 SJSU – CmpE M.E. Fayad

  3. Lesson Objectives • Overview of Previous Lecture • Discuss the following: • What is use case modeling? • Use Case Modeling -- Core concepts • Use Case Diagram tour • When to model use cases • Use Case Modeling tips • Examples: Library & University Registration 3 SJSU – CmpE M.E. Fayad

  4. What is use case modeling? • use case model: a view of a system that emphasizes the behavior as it appears to outside users. A use case model partitions system functionality into transactions (‘use cases’) that are meaningful to users (‘actors’). 4 SJSU – CmpE M.E. Fayad

  5. Use Case Modeling: Core Elements 5 SJSU – CmpE M.E. Fayad

  6. Use Case Modeling: Core Relationships <<extend>> 6 SJSU – CmpE M.E. Fayad

  7. Use Case Modeling: Core Relationships (cont’d) <<include>> 7 SJSU – CmpE M.E. Fayad

  8. Use Case Diagram Tour • Shows use cases, actor and their relationships • Use case internals can be specified by text and/or interaction diagrams • Kinds • use case diagram • use case description 8 SJSU – CmpE M.E. Fayad

  9. Use Case Model 9 Fig. 3-44, UML Notation Guide SJSU – CmpE M.E. Fayad

  10. Use Case Diagram: Relationships Fig. 3-45, UML Notation Guide SJSU – CmpE M.E. Fayad

  11. Use Case Diagram: Actor Relationships 11 Fig. 3-46, UML Notation Guide SJSU – CmpE M.E. Fayad

  12. Use Case Description: Change Flight • Actors: traveler, client account db, airline reservation system • Preconditions: • Traveler has logged on to the system and selected ‘change flight itinerary’ option • Basic course • System retrieves traveler’s account and flight itinerary from client account database • System asks traveler to select itinerary segment she wants to change; traveler selects itinerary segment. • System asks traveler for new departure and destination information; traveler provides information. • If flights are available then • … • System displays transaction summary. • Alternative courses • If no flights are available then … 12 SJSU – CmpE M.E. Fayad

  13. When to model use cases • Model user requirements with use cases. • Model test scenarios with use cases. • If you are using a use-case driven method • start with use cases and derive your structural and behavioral models from it. • If you are not using a use-case driven method • make sure that your use cases are consistent with your structural and behavioral models. 13 SJSU – CmpE M.E. Fayad

  14. Use Case Modeling Tips • Make sure that each use case describes a significant chunk of system usage that is understandable by both domain experts and programmers • When defining use cases in text, use nouns and verbs accurately and consistently to help derive objects and messages for interaction diagrams • Factor out common usages that are required by multiple use cases • If the usage is required use <<include>> • If the base use case is complete and the usage may be optional, consider use <<extend>> • A use case diagram should • contain only use cases at the same level of abstraction • include only actors who are required • Large numbers of use cases should be organized into packages SJSU – CmpE M.E. Fayad

  15. Sample Problem Statement: Library System • You have been contracted to develop a computer system for a university library. The library currently uses a 1960s program, written in an obsolete language, for some simple bookkeeping tasks, and a card index, for user browsing. You are asked to build an interactive system which handles both of these aspects online.* 15 *Example from: “Using UML”, by: Pooley and Stevens SJSU – CmpE M.E. Fayad

  16. First Step! • Time to start gathering the user requirements. • Different users will have different, sometimes conflicting priorities • Users will not, necessarily know what they want • It is very possible to miss something vital • The managers do not always know what the users have to do • Users can be, and frequently are, hostile. Why? What can be done about it? 16 SJSU – CmpE M.E. Fayad

  17. The Use Case Model • We must now identify the users of the system and the tasks they must undertake with the system. The details of the use case should be documented, using a Use Case Template. 17 SJSU – CmpE M.E. Fayad

  18. The Use Case Template Use Case Template PACKAGE: _________________ [Description (an over view of the package)]. USE CASES:[A package will have one or more Use Cases]. Use Case No.:[1.1] Use Case Title:[A descriptive title] [Ex. adding a new patient, or adding a new role]. Actors: _______, _______, _______, _______. [Any users of the Use Case, ex. human, machine, other systems or subsystems]. Corresponding Roles: _______, _______, _______, _______. [There is a different role per actor in every Use Case]. Classes: _______, _______, _______, _______. [List all the classes within the Use Case Description]. Enduring Business Themes (EBT): _______, _______, _______ Business Objects (BO): _______, _______, _______, _______. Industrial Objects (IO): _______, _______, _______, _______. [This represents a clear classification of all the classes within the use case description]. Description of the Use Case: [Describes the data flow and the logic flow of the Use Case]. 18 SJSU – CmpE M.E. Fayad

  19. Documenting Use Cases • A flow of events description is created for each use case • Written from an actors point of view • Details what the system must provide to the actor when the use case is executed • Typical contents • How the use case starts and ends • Normal flow of events • Alternate flow of events • Exceptional flow of events 19 Copyright © 1997 by Rational Software Corporation SJSU – CmpE M.E. Fayad

  20. JournalBorrower BookBorrower Librarian Browser Actors • An actor is someone or something that must interact with the system under development SJSU – CmpE M.E. Fayad

  21. Checkout Book Return Book Checkout Journal Use Cases Actors are examined to determine their needs • BookBorrower • Checkout and return books • Browser • locate and peruse items of interest • Librarian • maintain order and accountablility • JournalBorrower • checkout and return journals SJSU – CmpE M.E. Fayad

  22. Use Case Description • The usual course through the system when actor is using the system is called the basic course. Other courses would be modeled as extending Use Cases. • An example of a basic course would be: • Borrow copy of book A BookBorrower presents a book. The system checks that the potential borrower is a member of the library, and that s/he does not already have the maximum permitted number of books on loan. This maximum is six unless the member is a staff member, in which case it is 12. If both checks succeed, the system records that this library member has this copy of the book on loan. **Example from: “Using UML”, by: Pooley and Stevens 22 SJSU – CmpE M.E. Fayad

  23. Use Case Diagram for the first iteration 23 *Example from: “Using UML”, by: Pooley and Stevens SJSU – CmpE M.E. Fayad

  24. What Requirements would an ideal system satisfy? • Books and Journals: The library contains books and journals. It may have several copies of a given book. Some of the books are for short term loans only. All other books may be borrowed by any library member for three weeks. Only members of staff may borrow journals. Members of the library can normally borrow up to six items at a time, but members of staff may borrow up to 12 items at one time. New books and journals arrive regularly, and are sometimes disposed of. The current year’s journals are sent away to be bound into volumes at the end of each year.* 24 *Example from: “Using UML”, by: Pooley and Stevens SJSU – CmpE M.E. Fayad

  25. What Requirements would an ideal system satisfy? • Borrowing: It is essential that the system keep track of when books and journals are borrowed and returned, since the current system already does that. The new system should produce reminders when a book is overdue. There may in future be a requirement for users to be able to extend the loan of a book if it is not reserved. • Browsing: The system should allow users to search for a book on a particular topic, by a particular author, etc., to check whether a copy of the book is available for loan, and if not, to reserve the book. Anyone can browse in the library.* 25 *Example from: “Using UML”, by: Pooley and Stevens SJSU – CmpE M.E. Fayad

  26. Use Cases for the library 26 *Example from: “Using UML”, by: Pooley and Stevens SJSU – CmpE M.E. Fayad

  27. Example II: University Registration • The ESU University wants to computerize their registration system • The Registrar sets up the curriculum for a semester • One course may have multiple course offerings • Students select 4 primary courses and 2 alternate courses • Once a student registers for a semester, the billing system is notified so the student may be billed for the semester • Students may use the system to add/drop courses for a period of time after registration • Professors use the system to receive their course offering rosters • Users of the registration system are assigned passwords which are used at logon validation SJSU – CmpE M.E. Fayad

  28. Registrar Professor Student Billing System Actors 28 Copyright © 1997 by Rational Software Corporation SJSU – CmpE M.E. Fayad

  29. Maintain Curriculum Request Course Roster Maintain Schedule Use Cases • Actors are examined to determine their needs • Registrar • maintain the curriculum • Professor • request roster • Student • maintain schedule • Billing System • receive billing information from registration Copyright © 1997 by Rational Software Corporation SJSU – CmpE M.E. Fayad

  30. Maintain Curriculum: Flow of Events (description) • This use case begins when the Registrar logs onto the Registration System and enters his/her password. The system verifies that the password is valid (E-1) and prompts the Registrar to select the current semester or a future semester (E-2). The Registrar enters the desired semester. The system prompts the professor to select the desired activity: ADD, DELETE, REVIEW, or QUIT. • If the activity selected is ADD, the S-1: Add a Course subflow is performed. • If the activity selected is DELETE, the S-2: Delete a Course subflow is performed. • If the activity selected is REVIEW, the S-3: Review Curriculum subflow is performed. • If the activity selected is QUIT, the use case ends. 30 Copyright © 1997 by Rational Software Corporation SJSU – CmpE M.E. Fayad

  31. Request Course Roster Professor Student Maintain Schedule Billing System Maintain Curriculum Registrar Use Case Model • Use case diagrams are created to visualize the relationships between actors and use cases Copyright © 1997 by Rational Software Corporation SJSU – CmpE M.E. Fayad

  32. <<uses>> Register for courses <<uses>> Logon validation Maintain curriculum Uses and Extends Use Case Relationships • As the use cases are documented, other use case relationships may be discovered • A uses relationship shows behavior that is common to one or more use cases • An extends relationship shows optional behavior Copyright © 1997 by Rational Software Corporation SJSU – CmpE M.E. Fayad

  33. Possible Problems with Use Cases • Use Cases emphasize ordering. This can be considered to be incompatible with object technology. • Over modeling – Leads to requirement inflation. 33 SJSU – CmpE M.E. Fayad

  34. Cautions Do not invent requirements! • Use cases are about the user’s requirements, not about what you, as the designer might think that the system could usefully do! 34 SJSU – CmpE M.E. Fayad

  35. Acknowledgements • Object Modeling with OMG UML:Introduction to UML • Cris Kobryn • Chief Scientist, InLine SoftwareCo-Chair UML Revision Task ForceAugust 2000 • “Using UML: Software Engineering With Objects and Components” by: Rob Pooley and Perdita Stevens • “Analysis and Design with UML” Copyright © 1997 by Rational Software Corporation © 1999-2000 OMG and Tutorial Contributors: EDS, IBM, Enea Data, InLine Software,IntelliCorp, Kabira Technologies, Klasse Objecten, ObjectTime Ltd., Rational Software, Unisys 35 SJSU – CmpE M.E. Fayad

  36. Use Case No.: 1.1.1 Use Case Title: Find Candidate Actors: Registrar Roles: Data Entry Clerk (Registrar), Classes: IDSession, PersonProfile, PersonIdentifier, PersonTraits , CandidateListGenerator, DataManager Enduring Business Themes: (EBT): identity, security, Business Objects:IDSession,IDManager, DataManager,PersonIdentifier Industrial Objects:CandidateList,PersonTraits, PersonProfiles, SecurityManager,TraitGatekeeper Sample Use Case from Philips Project (1) 36 SJSU – CmpE M.E. Fayad

  37. Description of the Use Case: 1.The Registrar enters the information about a person into the System. 2.IDSession clears the request with Security. 3.The System tells the Person-Identifier to search for candidates. 4.The Person-Identifier gives the request to its DataManager 5.The DataManager determines a list of candidates, using its CandidateListGenerator and its set of PersonProfiles and returns it to the System. 6.The Registrar chooses the candidate from the list that represents the person. Sample Use Case from Philips Project (2) 37 SJSU – CmpE M.E. Fayad

  38. Use Case No.: 1.2.1 Use Case Title:Register New ID Actors:Registrar Roles: Data Entry Clerk (Registrar), Classes: IDSession, IDManager, PersonProfile, PersonTraits, CandidateList, PersonIdentifier Enduring Business Themes (EBT): identity, security Business Objects (BO): IDSession, IDManager, PersonIdentifier Industrial Objects (IO): PersonProfile,PersonTraits, CandidateList Sample Use Case from Philips Project (3) 38 SJSU – CmpE M.E. Fayad

  39. Description of the Use Case: 1.The Registrar enters the information about a person into the IDSession. 2.The IDSession has security clear the request. 3.The IDSession has the PersonIdentifier search for candidates. 4.The Person-Identifier determines that no candidates fit the criteria. 5.The Person-Identifier gives this information to the system. 6.The informs the Registrar that no candidates exist. 7.System asks the Registrar if the person should be added as new. 8.Registrar tells System to add new person. 9.System sends traits to ID-Manager. 10.ID-Manager creates a new profile. Sample Use Case from Philips Project (4) 39 SJSU – CmpE M.E. Fayad

  40. Exceptional Flow of Events 01: If any of the identifying information entered by the Registrar is incomplete or invalid the system displays corresponding error message(s). The system will not validate the New Person until all identifying information is made available. Exceptional Flow of Events 02: In case the system determines that one or more of the identifying information for a person matches one or more person(s) already in the system the Registrar is displayed with a screen listing all the person(s) meeting the search criteria. The Registrar is then given the opportunity to either create the person in the system with a new ID or pick one from the selection list. Sample Use Case from Philips Project (5) 40 SJSU – CmpE M.E. Fayad

  41. Use Case No.: 1.3.1 Use Case Title: Get Patient Profile using Patient ID Actors / Roles: Nurse, Patient, and Profile Access Classes: Enduring Business Themes (EBT): Diagnosis, Customer Service and Complete Medical History Business Objects (BO): Profile Access, Identify Person and Identity Industrial Objects (IO): Identity Access Sample Use Case from Philips Project (6) 41 SJSU – CmpE M.E. Fayad

  42. Description of the Use Case: 1.The Nurse enters the Person ID for the person. 2.The Person Identification system determines the validity of the Person ID. 3.The Get Profile System returns the profile the specified Person ID. Exceptional Flow of Events 01: If the Person ID is invalid an error message is displayed. The nurse then can decide either to search the system with person identification information or redirect the person to a Registrar. Sample Use Case from Philips Project (7) 42 SJSU – CmpE M.E. Fayad

  43. Bibliography and Suggested Reading • “Object-Oriented Software Engineering: A use Case Driven Approach”, by Ivar Jacobsen • “Use Case Modeling: Capturing User Requirements” by Edward Kenworthy (http://www.zoo.co.uk/~z0001039/PracGuides/pg_use_cases.htm) • “Structuring Use Cases With Goals” by Alistair Cockburn (http://members.aol.com/acockburn/papers/usecases.htm) • “Use Cases Fundamentals” by Alistair Cockburn (http://members.aol.com/acockburn/papers/AltIntro.htm) • “OOSC2: The Use Case Principle” by Bertrand Meyer (http://www.elj.com/elj/v1/n2/bm/use-cases/ ) • “The Roles of Use Cases in Analysis” by Daniel A. Rawsthorne, PhD (http://www.pols.co.uk/usecasezone/UseCaseConcepts.html ) • “The Misuse of Use Cases” By Dr. Timothy Korson (http://www.software-architects.com/publications/korson/Korson9803om.htm ) • “Constructing Useful Use Cases” By Dr. Timothy Korson (http://www.korson-mcgregor.com/publications/korson/usecase3/index.html ) SJSU – CmpE M.E. Fayad

  44. What are the use case modeling good, bad, and ugly? Define: Actor, role, and use case What are the differences between use cases and scenarios? What are the differences between use case and a process? Discussion Questions 44 SJSU – CmpE M.E. Fayad

  45. Discuss the ways to analyze a problem. What is a problem? What are the elements of problem analysis? Questions for the Next Lecture 45 SJSU – CmpE M.E. Fayad

  46. Task 1: Assignment # 1 is due on ___________. Late assignments are not acceptable. Task 2: Check the web site for new postings Tasks for Next Lecture 46 SJSU – CmpE M.E. Fayad

More Related