|Lesson 6||Use case description, part 2|
|Objective||Add assumptions, pre-conditions, and post-conditions to the Use Case Narrative.|
Use Case Pre-conditions and Post-Conditions
Each use case should represent a discrete unit of work. Each unit has a specific role within the overall functionality of the system.
To define the unique role for each use case, you must document the relationship of the use case to the other behaviors of the system.
Three additions to the use case template can help properly position each use case in relation to the other use cases:
Each use case is only one part of a complete system. When certain behaviors must be handled by another use case prior to allowing anyone to access this use case, specify these conditions as assumptions.
For example, verify that the user has permission to access this feature.
Pre-conditions are tests that must prove true before the use case is allowed to proceed. However, unlike assumptions that are handled by another use case, pre-conditions are checked by the use case that contains the precondition.
For example, verify that the required parameters were passed and are valid.
Assumptions and pre-conditions also define precedence among use cases. Use case precedence in turn supports screen and workflow design by defining the order in which use cases must be executed.
Good design requires that processes clean up after themselves so that subsequent processes are not corrupted. Post-conditions identify the items that the use case must handle before terminating.
Sometimes these activities may be part of the normal and exceptional event flows. Other times they must be added. For example, after you complete a transaction, it is often useful to add the transaction to a history file so that it can be audited and/or reversed at a later date.
Writing Effective Use Cases
Example of an extended use case template
Here is an example of an extended use case template:
|Use Case Name
||Verb and Noun that expresses the goal of the use case, for example, "Deposit Funds."
||Conditions that must test true before this use case will execute. This use case assumes that some other use case is taking responsibility to test the condition
||Conditions that must true before this use case will execute. This use case is taking responsibility for testing the condition.
|Initiation (Triggering event)
||This use starts when ...
Idenity how the use case knows when it is time to try to accomplish its goal
|Main flow of events
||Describe the succesful dialog between the actor and the use case.
|Exceptional flow of events
||Describe a dialog that does not achieve the stated goal of the use case, i.e. an exception.
||Conditions that must test true before exiting this use case
Assumptions, pre-conditions, and post-conditions are valuable additions to the definition of any behavior in your system.
A complete specification helps avoid errors during construction.
Now lets use the template to create a narrative for the use case Deposit Funds.
- Start with our earlier example and add the new narrative elements
- Add the assumptions, conditions that must be tested outside of this use case and before this use case may be executed.
- Add the pre-conditions, conditions that are tested by this use case that must prove true
- Add the post-conditions, condition that are tested by this use case and that must prove true before
Extended Use Case Narrative
Use Case Narrative - Quiz
Write Extended UseCase - Exercise