Monday 23 May 2011

Adding Flesh to the Bones – Primary Scenarios

Alex, one of our Systems Engineering trainers, continues to share his wisdom in another post in his series on Use Cases. 


Having defined the structure of the use case it is now time to describe the behaviours and interactions that occur during the execution of the use case; the flow of events if you like.

For this we will write use case scenarios to document the dialogue between the system and actors as the use case achieves its goal.


A scenario is an instance of a use case, i.e. it is one flow through the use case.  Each use case will have many possible paths through.  We first write an easy to understand description of a typical scenario in which the use case delivers the primary actors goal, i.e. the actor gets what he/she wants.  This main scenario is frequently known as the primary scenario.  All other paths through success and failure are described as extensions to the primary scenario, sometimes called alternate scenarios.


Let's bring in the ATM example.
Use case scenarios are normally captured using simple text.  Each scenario captures a specific path through the use case in a single flow of events that contains no branching. There is one primary scenario and several alternate scenarios documenting all of the relevant success and failure cases.


 It can be difficult to describe iterations, branching and/or concurrency using text, and therefore scenarios can be also described using sequence, state machine or activity diagrams. For now let us concentrate of the text. 


Textual scenarios are written as a sequence of goal-achieving actions by the various actors. Each action step will describe one of the following:

  • An actor interaction         -              “Customer enters PIN” 
  • A validation step              -              “System validate PIN code”
  • An internal change           -              “System deducts amount from balance”

There are a number of useful guidelines for use case scenario action steps:

  • Use simple grammar and vocabulary
  • Write everything in the same tense
  • Show clearly who is involved in each step
  • Write from a consistent perspective
  • Show the process moving forward
  • Show the actor’s intent not how he does it
  • Limit each scenario to between 3 and 11 action steps
  • Number each action step

As with all modelling your first draft is unlikely to represent the final incarnation of the primary scenario and may need to be modified once the alternate scenarios have been written. That, however, is a discussion for another day.

No comments :

Post a Comment