250 likes | 399 Views
Use Case Actors, Associations, and Use Case Specifications. Use Case Book (Chapter 2). 1. Actors. Actors trigger the start of a use case. people, computer systems, date/time, relay, device... Actors must receive value from the system
E N D
Use Case Actors, Associations, and Use Case Specifications • Use Case Book (Chapter 2) 1
Actors • Actors trigger the start of a use case. • people, computer systems, date/time, relay, device... • Actors must receive value from the system • Systems that are actors generally supplying data or services to your system and vice versa. • May be a legacy RDBMS or a legacy VSAM file… • Pressure and temperature may be actors (triggers), as well as a device, such as a conveyer belt, giving a signal to start… 2
Use Case Associations Extend/Include Stereotypes • Stereotyped associations indicate a special kind of association. (good pix – Chap 2, Use Cases, Fig 2.12) • Extending (blunt side) is a special use case that extends the original use case (sharp) • “Extending use case” would not exist without the use case it is extending (the extended use case); • Used for special cases; exceptional behaviors. Inserted behaviors • Arrow points toward the base use case that is being extended… • Include stereotype allows use case designers to avoid duplicating steps across multiple use cases (a reuse strategy). • Arrow extends away from the owning parent use case. • e.g. Authenticate User • Note: controversial; • Many Use Case authors do not like these and include the steps within the use case itself or use some other kind of sub-flow (later). 3
(Primary use case) (extended) Use Case extending Use Case (inserted behaviors) (Primary use case) Use Case Included Use Case (Particularly good for reuse!) 4
Exception and Alternative Paths • Exceptions are generally errors that may occur. • Interactions thus contain steps to be executed. • Alternatives may / may not be close to basic course of events – just not the most likely y of events. • No errors- but some authors treat these to document error conditions. • Alternatives may be just as important as the basic course…Often the case. • Some authors treat alternatives as MUCH less likely to occur. I don’t. • Alternate Paths: very important to capture them (with full interactions in most cases, too). • Exception paths should be kept separate from alternative paths. • All have a home with their use-case. 5
We: Know that Use Cases represent / can capture the functional requirements of an application. Know that there are ‘levels of maturity’ or ‘granularity’ of Use Cases. Know about Façade Use Cases and Know about the use of a template. Know different organizations will likely require different formats, attributes… Introduction 2 7
Recall the format in wide use – but not the only format. 3 8
4 9
Also recall facts about Façade Use Cases: Identify the Use Cases Placeholders Help to establish a framework for further maturity development Help to establish application boundary Contain a number of attributes, but no basic course of events is included. Often Features may map one to one to a use case if feature is general (abstract) enough. Façade Use Cases 5 10
Continuing…. 12
Use Case Attributes • Use Case Attributes • Triggers - entry points for a use case • Assumptions – • document things assumed to be true (but might not be true) (Critical section.) • Preconditions – • Things that must be in place before an interaction may occur. (part of contract between use case and outside world) • Post Condition – • part of contract between use case and outside world; specify outcomes; independent of alternative path. e.g. transaction successfully posted. • Related Business Rules • - Reference to business rules Related Risks addressed by this Use Case. • Include a reference to the Risk List document • Author and Date • at bottom; original date for each version: façade, filled, focused etc. 13
The Use Case Specification • A page or two of text; corresponds to a rounded oval in the Use Case diagram. Relate horror stories!! • Definitely need some kind of a standard template. • Most organizations using Use Cases develop their own template format. Consistency is critical. • In all, the Use Case Specification should contain most of the following attributes: • Name, iteration name/number; author, description, basic course of events; alternative paths, exception paths, triggers, assumptions; preconditions; post-conditions; references to related business rules; risks lists, and more. • All seem important. 14
The Use Case Specification -2 • We have also indicated the need for an Index of Use Cases. Designate each use case as UC1, …, UCn. • Included again as next slide • Have already discussed the UC name: verb -> object • Iteration = the ‘maturity’ of the use case – and hence the maturity of our understanding of the functional requirements. (façade, filled, focused … many name variations…) • Descriptions –sentences describing the interaction. • Sometimes considered a ‘user story’ 15
The Use Case Specification -3 • Basic Course of Events – (NOT in Façade) • actor always takes first step (trigger) • always have a ‘happy path’ • Simple path; Most likely path) • Can include a picture, if helpful. (screen shot, etc.) • This is the ‘typical’ or ‘most likely’ scenario • Sometimes difficult to pick the ‘most likely’ 17
Use Case Specifications - 4 • Alternative Paths • Other paths (may be less common; sometimes equally likely) • Each alternative and exception (below) should indicate WHERE in the basic course of events the alternative / exception emanates from. Starting point. And Return point to use case flow – unless terminated within alternative flow • Techniques: • cite the step number; • labels in the basic course of events (preferred). Discuss. • Exception Paths • Like alternatives but typically shown for errors. • Similar formatting rules as Alternatives – simply used for exceptions.
The Use Case Specification -5 • Difference between <extends> and extension points. • <extends> Refers to another extending use case. • The <<extends>> relationship exists between use cases when one use case provides an optional sequence of events that is inserted in the other use case. (See pg. 42, Use Case text) • Note: the extending use case points to the extended use case. • Again, this implies ‘inserted’ behaviors. • Extending use case has ‘no life’ without the extended use case • ExtensionPoints • “Extension point” in the flow of events shows step name (in braces) or step number from which the extending use case extends. (more later) 19
Paths and Scenarios • Use Cases – abstractions • Really need detailedinteractions – scenarios. • Scenarios can provide details of the interactions! • Scenarios are instantiations of Use Cases: • Use Cases with data • Book provides three definitions for scenarios: • 1: merely an alternate path; • 2: an instantiation of the use case with a specific path plus relevant data; • 3: same as a use case (synonyms) 20
Paths and Scenarios -2 • Definition #2 – the “Instance,” where the scenario is a realization of a use case (one possible path) with included data. • This is our preferred definition. • Scenarios can be used • during requirements capture for feedback to users and analysts that the use cases accurately reflect user needs, and • in testing to test whether the system reflects the requirements. • In driving design (nouns, verbs, behaviors, …) • Scenarios, then, are instances, of use cases (complete with production data) that effectively test one path through a use case. 21
Use Case Packages • A package (looks like a folder) is a generalgrouping of related model elements such as classes, use cases, or Actors. • Very desirable to group use cases into packages primarily because these packages can be used to form logical boundaries for dividing work among sub-teams. • A good rule of thumb – each package may correspond to a chapter or at least a major section in the user manual. • A division of functionality, responsibilities, etc…… • Package Diagrams may contain use cases that are related….These go to functionality (architecture later) 22
More – very important tidbits here. • The relationship between requirements and use cases is subject of much discussion. • A use case describes a unit of behavior • A requirement describes a law that governsbehavior • A use case can capture/satisfy/describe one or more functional requirements • A functional requirement may be satisfied by one or more use cases… • Once again, note that a system will have other requirements besides ‘functional,’ such as performance, maintainability, scalability, reliability… that don’t map easily to use cases…. • Non-functional requirements tend to ‘thread themselves through Use Cases.’ • Some will readily be captured via the software architecture (later in course). 23
More – very important! • At end of use case modeling, you are ready to embark upon the creation of an Analysis Model (or preliminary design) • Generally entering a second iteration within Elaboration Phase in the UP • This will involve very careful and highly iterative analysis of use cases and all their scenarios. • Undertake prototyping user interface, preliminary db design, developing analysis classes and interactions (behaviors), preliminary test design, and more. • This can only take place after the full Use Case Model is ‘completed.’ 24
Common Mistakes • 10. Write functional requirements instead of usage scenario text • 9. Describe attributes and methods in too much detail rather than usage • 8. Write the use cases too tersely (won’t do much good!) • 7. Divorce yourself completely from the user interface • Big mistake!!! • 6. Avoid explicit names for your boundary objects. (more later) • 5. Write using a perspective other than the user’s, and doing so in passive voice. • 4. Describe only user interactions; ignore system responses. • 3. Omit text and references for alternative courses of action • 2. Focus on something other than what’s ‘inside’ a use case, such as how you get there (precondition) or what happens afterward (post-condition). • 1. Spend a month deciding whether to use <<include>> or <<extend>> associations. 25