Use Cases G. Falquet, L. Nerima
ISIISI June G. Falquet, L. NerimaUse Cases 2 References Jacobson, M. Christerson, P. Jonsson, G. Overgard “ Object-Oriented software engineering : A use case driven approach ” Addison-Wesley 1992 Jacobson,,M. Griss, P. Jonsson “ Software Reuse : Architecture, Process and Oranization for Business Success ” Addison-Wesley 1997
ISIISI June G. Falquet, L. NerimaUse Cases 3 Motivation (software engineering) " Solve the right problem " vRequirement analysis vDetermine the requirements - what the system should do vUnderstand the requirements vDelimit the system vUser centred analysis vCapture requirements from the user's point of view vIntegrate user views
ISIISI June G. Falquet, L. NerimaUse Cases 4 Motivation (business reengineering) vConsider the organisation as a system vUnderstand what the organisation does vReconfigure the organisation Reference vI. Jacobson. The Object Advantage, Business Process Reengineering with Object Technology. ACM Press.
ISIISI June G. Falquet, L. NerimaUse Cases 5 UML Development phases vInception Find the limits of the system, specification, feasibility voutput: requirement model = use cases vElaboration Analysis, architecture, resources, planning vextend use cases vConstruction Design, implementation, tests vTransition Delivery, maintenance
ISIISI June G. Falquet, L. NerimaUse Cases 6 Use cases (principles) vWhat the system should do (desired behaviour) vNot how to carry out that behaviour vNo programming details vIndependent of the realisation vA tool to communicate vend user / domain expert developer / designer
ISIISI June G. Falquet, L. NerimaUse Cases 7 Use cases and User-System Interactions vA use case describes the interaction between an actor and the system vThe interaction yields a tangible result for the actor vThe interaction is a sequence of actions vTransactions are expressed in terms of domain objects
ISIISI June G. Falquet, L. NerimaUse Cases 8 Users and the System User Use Case 2 System Use Case 1 Use Case 3 Services
ISIISI June G. Falquet, L. NerimaUse Cases 9 Actor vWhat exists outside of the system vAnything that needs to exchange information with the system vperson, machine, organisation, other computers, other system vCorresponds to a generic role that a user plays = a way of using the system vThe same person (machine, …) may play several roles
ISIISI June G. Falquet, L. NerimaUse Cases 10 Example: Library Library System Librarian Researcher Department
ISIISI June G. Falquet, L. NerimaUse Cases 11 Example Online Shopping System Customer Supplier Credit Card Institution Postal service Internet Shop Manager "Albert"
ISIISI June G. Falquet, L. NerimaUse Cases 12 Classification of Actors Customer First Time Customer Registered Customer
ISIISI June G. Falquet, L. NerimaUse Cases 13 Use case: definition vDescription of a set of sequences of actions, including variants, that a system performs to yield an observable result of value to an actor. Borrow a book Reserve a book Pay membership Browse catalogue Register new user
ISIISI June G. Falquet, L. NerimaUse Cases 14 Use cases and their users (actors) Borrow a book Reserve a book Pay membership Browse catalogue Register new user Researcher External user Librarian
ISIISI June G. Falquet, L. NerimaUse Cases 15 Example Customer Supplier Credit Card Institution Manager Buy an item Check payment Search catalogue Change prices Order item
ISIISI June G. Falquet, L. NerimaUse Cases 16 Use cases and scenarios Use case: Search library catalogue vMain flow of events: The user clicks the 'search' button. The system displays a text field in which the user can enter one or more keywords. The user validates the entry by clicking the 'go' button. The system displays a list of relevant items. vExceptional flow of events: The user opens a terminal window. The user types 'sr', a list of keywords, and ' '. The system displays a list of relevant items.
ISIISI June G. Falquet, L. NerimaUse Cases 17 Scenario vDescribe the flow of events vIn natural language vin terms of domain objects (--> object diagrams) vand actions vOne main scenario and alternative scenarios
ISIISI June G. Falquet, L. NerimaUse Cases 18 Library Example: Locate Media vPrimary Path: (Media Located) The librarian and borrower (researchers) will both search for media topics in the library through a computer display. The topics can be located by type, title, author, keywords in the description as well as specific media type selections (ex software format). The results of the search are displayed to the researcher in summary format. The detailed descriptions of each media topic can then be displayed as well as printed. vAlternate Path: (Media not Located) The system does not locate the media. The researcher is informed of this result and can then edit the previous query or cancel the request.
ISIISI June G. Falquet, L. NerimaUse Cases 19 Use case: Add Media vPrimary Path: (Add Media for New Topic) The librarian will interact with a computer display to enter in a new media topic and copy. The librarian will enter the title, author, and description for the media topic and serial numbers for each new copy. The librarian will also be able to enter the following information for specific types of media topic: vBooks: pages vSoftware: format and version vVideo Tapes: format and rating The new media is entered into the library system and is now available for borrowers to search for and check-out. vAlternate Path: (Add Media for Existing Topic) The librarian will search for the media topic by title and author and add the new serial numbers for the additional copies.
ISIISI June G. Falquet, L. NerimaUse Cases 20 Use case taxonomy Register Student Member Register Member Register Voting Member Search Document Base Advanced Search Register Person Register Visitor
ISIISI June G. Falquet, L. NerimaUse Cases 21 Taxonomy (cont.) vGeneric - specific relationship. vExtract common behaviour. vBehaviour of the child must include the behaviour of the parent (substitutability). Register Member Type name Obtain member no. Register Student Member Type name Type university name Type student no. Obtain member no. Update student database
ISIISI June G. Falquet, L. NerimaUse Cases 22 Add Media Locate Media > Use Case Relationships : Inclusion vInclude the behaviour of another use case. vBreakdown of complex behaviour Check User Identity Buy Item Validate Payment > Remove Media >
ISIISI June G. Falquet, L. NerimaUse Cases 23 Use Case Relationships : Extension vAdditional sub-course of events (conditional) vComplex alternate path at given extension points Add Media Add Book > Search Document Base extension point Query details Advanced Search > (query details)
ISIISI June G. Falquet, L. NerimaUse Cases 24
ISIISI June G. Falquet, L. NerimaUse Cases 25 Scenario Writing Rules vDescribe the activity : "what" not "how" E.g. operator checks user identity vKeep it simple Decompose complex cases with > or > vAutonomy Do not mix use cases vDirect style No ambiguity, no approximation ("very", "rather", "somewhat", "few", "often", "in general" vA scenario is a (long) transaction Beginning and end All or nothing executed
ISIISI June G. Falquet, L. NerimaUse Cases 26 Scenario Writing: Use Linguistic Constructs while condition do : > repeat n times : > if condition: then > else > choices : condition : >...
ISIISI June G. Falquet, L. NerimaUse Cases 27 Scenario: Check user identity user enters desired amount with the keyboard user presses 'OK' check if amount realizable with available banknoted while amount not realizable do : system proposes another amount user may change the amount user presses 'OK' prepare banknotes eject user card wait for user to take banknotes
ISIISI June G. Falquet, L. NerimaUse Cases 28 Use Cases and Objects vTwo different modelling axis vDifferent views of the system vRelationships between use cases and objects vObjects represent vthings used during a flow of events vtasks performed vcommunications with the world vObjects formalise the internal organisation of use cases
ISIISI June G. Falquet, L. NerimaUse Cases 29 Objet Modelling vRepresent real-world entities (concrete or abstract) va book owned by the library va borrower va loan va user interface window van event's occurrence (button 'OK' was pressed at 16: ) vContain data vHave a state and a behaviour vMay be related to each other vObjects are in the system
ISIISI June G. Falquet, L. NerimaUse Cases 30 System = Set of Interacting Objects vObjects vexchange messages to execute operations vform the memory of the system catalog search controller query window book loans result window
ISIISI June G. Falquet, L. NerimaUse Cases 31 Some Objects "Applied UML" by J. Hall available "Mars Attacks" by H. G. Wells unavailable "Moby Dick" V. Hugo borrowed Jean Dupont Rue du Mt Blanc, 13 a g b e3 data
ISIISI June G. Falquet, L. NerimaUse Cases 32 Objects = Data + Behaviour vObjects have operations to vAccess their data vChange, process their data borrow return get Title get Author Data borrow(3.7.01) message get Title() "Mathemagical Themes"
ISIISI June G. Falquet, L. NerimaUse Cases 33 Classes vCategorise objects Book Employee Manager a b g e3
ISIISI June G. Falquet, L. NerimaUse Cases 34 Classes and Object Structure vDefine a common structure and behaviour vAn object is an instance of a class instance a: Book Book b data Book title author status borrow() return() getTitle() getAuthor() g: Book title = "Moby Dick" Author = "V. Hugo" Status= borrowed b: Book
ISIISI June G. Falquet, L. NerimaUse Cases 35 Classes have Relationships Book title author status Catalogue creation date last update composed of Loan due date Member name address borrower book
ISIISI June G. Falquet, L. NerimaUse Cases 36 Represent Which Entities ? vUse cases determine entities to be represented. Scenario: "Check the book's availability. Check the user's status; Register the loan" => The system needs objects to represent books, users and loans (not bookshelves, doors, seats, tables,...) vAvoid the endless modelling syndrome.
ISIISI June G. Falquet, L. NerimaUse Cases 37 Use Cases and Objects vRefinement of a use case --> implementation vConnect use cases to relevant object classes Borrow a book Reserve a book Browse catalogue Register new user Book Reservation Loan User Catalogue Librarian Bookshelf Author
ISIISI June G. Falquet, L. NerimaUse Cases 38 Scenarios and Objects: Sequence Diagrams The librarian will add a new book to the library by creating a new book media topic through a card catalog window. In creating the media copy (book), the librarian will supply parameters of title, description, author, and pages. An existing topic is searched for in the existing topics. The successful addition is reported to the librarian. The librarian can then add a new media copy for each copy of the book (refer to Add New MediaCopy).
ISIISI June G. Falquet, L. NerimaUse Cases 39 Scenario: Add Media Copy The librarian first requests the media topic from the card catalog window. A set of search criteria is filled in and used to locate the media topic in the card catalog. Once found, the media topic can have many operations performed on it. In this instance, the librarian requests that a new copy be added. The librarian will supply a bar code for the new copy. The media topic adds the new copy and the librarian is informed of the successful completion.
ISIISI June G. Falquet, L. NerimaUse Cases 40 UML forBusiness Reengineering vSystem = Organisation (company, office, etc.) vUse case = Generic service vObject = Parts of the system vObjective: understand how the system works vEventually: change the system / organisation
ISIISI June G. Falquet, L. NerimaUse Cases 41 Object Categories vEntity objects vThings and products used during a flow of events (scenario) vProcessors vTasks that must be performed vInterfaces vTasks that communicate with the outside world
ISIISI June G. Falquet, L. NerimaUse Cases 42 Example: Restaurant Serving Lunch Serving Dinner Purchasing Supplies Restaurant
ISIISI June G. Falquet, L. NerimaUse Cases 43 Restaurant: Serving Dinner [Jacobson] Guest Cloakroom Attendant Order Handler Head Waiter Sitting Plan Check Order Dish Menu Beverage Food Preparer Recipe
ISIISI June G. Falquet, L. NerimaUse Cases 44 Fast Food Restaurant: Serving Dinner Guest Order Handler Sitting Plan Order (Check) Dish Menu Beverage Food Preparer