220 likes | 376 Views
Advanced Use Cases. Use Case Analysis. Managing Complexity. Objectives Familiarisation with techniques for further use case analysis Contents Packaging Generalisation and specialisation of actors Inclusion Extension Generalisation and specialisation of use cases
E N D
Advanced Use Cases Use Case Analysis
Managing Complexity • Objectives • Familiarisation with techniques for further use case analysis • Contents • Packaging • Generalisation and specialisation of actors • Inclusion • Extension • Generalisation and specialisation of use cases • Pre- and post-conditions • Summary
Packaging Use Cases Sales Enquiries Booking Customer Cancelling Location Admin Complain etc… • Packages can be used to organise use cases • Packages contain packages and/or use cases • Each use case belongs to one package Booking Make Provisional Booking Confirm Booking
Actor Generalisation/Specialisation Customer Client • Use generalisation/specialisation to classify actors • Generic actors have use cases common to all specialised actors • Specialised actors have special use cases Make Enquiry Book Package Change Booking Cancel Booking
Use Case Inclusion • Extract a common sequence of events • From multiple use cases • Create a new inclusion use case • Modify the base use cases to include the inclusion 1. The use case starts when the customer requests to book a course. 2. Include ‘Check location list’ use case. 3. If there are places available, . . . Book holiday Base Enquire re holiday «include» 1. For each course that the customer selects: a) the package run is identified to the system b) the system finds the package run location list c) the system checks for availibility «include» Inclusion Check location list
Use Case Extension • Base use case • Add extension points - locations where extensions are allowed • Extension use cases • Specify the added behaviour at one or more extension points 1. The use case starts when the customer requests to book a holiday. 2. Include ‘Check location list’ use case. 3. If a place is available create booking... extension point: [holiday full] ‘Offer alternate holiday’ is called… Base Book holiday «extend» [holiday full] extension ‘Offer alternate holiday’ 1. The location list for the next holiday is found... Offer alternate holiday Extension
Use Case Generalisation • Child use case • A more specific form of the parent • Modifications of the parent behaviour are allowed throughout • Parent use case • May be concrete or abstract (abstract in italics) 1. The customer chooses a payment method. 2. The details are checked, and recorded. Pay for holiday Parent 1. The customer chooses to pay by credit card. 2. The credit card details are read. 3. The system contacts the credit agency and requests payment of the required amount from the supplied card. Pay for holiday By Credit Card Child
Use Case Dependencies - Summary A A A «extend» [cond3] «include» «extend» [cond1] «include» «extend» [cond2] «include» X Y Z X Y Z X Y Z «include» A always contains X, Y and Z «extend» A or A+iX or A+jY or A+kZ or A+iX+jY or A+iX+kZ or A+jY+kZ or A+iX+jY+kZ generalisation X, Y or Z (A is abstract) i, j, k = no of times cond 1, 2 or 3 is true
Quick Exercise - 1 • Context: A worker having a lunch break Eat Lunch Eat packed lunch Worker Eat lunch at pub Eat lunch at restaurant
Quick Exercise - 2 Travel to work Worker Take a tube journey Take a bus journey Take a train journey • Context: From the worker travelling to work
Quick Exercise - 3 Buy a holiday Holiday Maker Buy Travel Insurance Buy Flight Buy Accomodation Exchange Money Rent a Car • Context : From the holiday maker using the services of a travel agent
Quick Exercise - 4 Change Oil Customer Get Car Serviced Set Timings Collect from Home Deliver Back to Home • Context: From the perspective of the customer
Pre- and Postconditions • A precondition says “before this use case can be invoked, X must be true” • A postcondition says “when this use case is finished, Y must be true” • A pre- or postcondition represents a system state • They can be used to check success or failure of a use case
Pre- and Postconditions • A use case causes a transition from the precondition state to the postcondition state • This can be shown on a State Transition Diagram e.g. X is true switched on and tape in precondition precondition use case J use case ‘Play tape’ VCR system states System states postcondition postcondition Y is true playing
Pre- and Postconditions • No ‘Magic’… initial state use case ‘Switch on’ ? postcondition switched on ? postcondition precondition use case ‘Load tape’ switched on and tape in post switched on and tape in precondition use case ‘Play tape’ pre postcondition use case ‘Play tape’ playing post playing
Pre- and Postconditions • … and no ‘Black Holes’! use case ‘Switch on’ post final state switched on and tape in pre use case ‘Switch off’ switched on post precondition use case ‘Play tape’ use case ‘Eject tape’ use case ‘Load tape’ pre postcondition switched on and tape in playing post precondition use case ‘Stop tape’ ? use case ‘Play tape’ ? post pre playing
Pre- and Postconditions • STDs can be represented in table form for greater rigour
Pre- and Postconditions • Detail can be added for all possible combinations…
Summary • Various techniques can be used in the further analysis of a use case model • Packages • Actor generalisation/specialisation • Use case inclusion • Use case extensions • Use case generalisation • Pre- and postconditions • Care should be taken not to over-engineer the model
Summary Problem Statement It all starts here... Use Case Diagram Scoped by 1 1 1 1..* 1 1 Use Case SystemBoundary Actor 1..* name {unique} author actor[1..*] 1..* invoked by /primary /secondary pre-condition 1..* main flow[1] Dependency base post-condition 0..* alternate flow[n] 0..* « include » generalise « extend »
Case Study - Exercise 6 • Objective • Identify use case packages • Understand difference between includes, extends and generalisation • Turn to and complete exercise 6 in the exercise booklet