Writing Effective Use Cases, Part III

Review practical examples of how to tailor the Use Case creation process around the type of iterative lifecycle defined in the Agile methods.
- Ed Carroll, Sales Executive, Agilis Solutions

August 16, 2006

Introduction
My earlier article on Writing Effective Use Cases gave some general good writing tips. My second article on Use Cases (Applying RAD) described how to shorten the time dedicated to writing and analyzing use cases by utilizing focused and facilitated workshops (aka, JAD sessions). Neither of these articles deal with the software development methodology encasing the requirements defined within the use cases. In this article, I’ll deal with the methodologies surrounding the use case development.

There should be little difficulty in understanding the requirements of a software product when there are less then six people involved in a project; team members know who to talk to about what issue. However, as teams grow in number and projects become more complex requirements tend to become more dynamic, increasing the likelihood that changes will be needed. Similarly, complex products have greater risk because they are more expensive, employ larger teams and typically have more urgent time-to-market demands. At the same time, products developed under the Agile development methods (XP, SCRUM, etc) are demonstrating significant advantage to traditional methods in responding to dynamic requirements. However, Agile methods have typically been applied to small projects. Is it possible to gain the same advantages on a large complex project? This article will provide some practical examples of how to tailor the Use Case creation process around the type of iterative lifecycle defined in the Agile methods.

Use Cases vs. User Stories
"Agile" software development methods typically utilize CRC cards, User Stories, verbal collaboration and acceptance tests to define requirements. It is not my intent to jump into the argument of whether Use Cases are better then User Stories, or vice versa. For those discussions I suggest you start by reading Alister Cockburn’s WebLog. If you do read the discussions, you will see some general agreement that the Agile methods work better for small teams where the customer is physically co-located with the developers. And Use Cases (typically in a traditional methodology) are better for projects that involve large engineering teams and/or when the client and developers are geographically dispersed. There is also some general agreement that the processes for creating and documenting Use Cases provide needed formalization of the communication processes necessary for success.

However, there are some valuable concepts within the Agile methods that can be applied to large complex projects which can further success on these large complex projects by using use cases to formalize communication and an iterative development lifecycle to amortize and prioritize requirements across the release cycle.

Brainstorm with CRC cards
Domain experts often have trouble knowing where to start when it comes to defining system requirements. Asking them to simply write down their user stories, or to fill out a use case template, can induce severe writers block. In my experience, the larger the group of domain experts, the more likely it is for this syndrome to occur. Having a task that helps to draw out the ideas without worry of condemnation or where to start always helps. To get the creative juices flowing from a large group of domain experts, I like to use CRC cards in a brainstorming workshop such as I described in my previous article (Applying RAD). CRCs are useful in two ways; first they help to limit the details that need to be defined, while at the same time allowing a good flow of generalized ideas which can then be fleshed out later (as full use cases), but which allow categorization and prioritization for release and iteration planning to happen. Too often, brainstorming is limited to very short one line or single word statements which do not provide sufficient understanding of their intended content. So, the secondary value of CRC cards is that they encourage a fuller statement of intended content.
Record the User Stories
In the Agile methods, domain experts describe their User Stories to the developer verbally. This works well when the domain expert and the developer are few in number (aka, one each) and co-located. Increase the team membership and disperse them across different geographies and time zones, and verbal communication gets lost. However, it is now very easy to record as a digital audio file any conversation, interview, phone call, or story telling. The audio file can then be played back by team members who were not present at the discussion, or simply to enhance one’s memory of the details discussed, and retained within the digital repository of project data.
Test First - For Real!
The Agile methods, applied thoughtfully, promote good software engineering practices. And in my view, Test First is unequivocally the most valuable concept of all of the Agile techniques. Think about what a process such as Test First does to the development lifecycle and the mental thought processes involved in developing a software product. Traditionally, we create test plans during the design phase based on the "completed" requirement, but of course, these requirements are never complete. If we are very conscientious, we include new test cases to correspond with new requirements that are defined during the design and code phases, or that accommodate the system or technical level requirements (defined in the design or code phases). However, how often are we very conscientious (be honest)?

Creating the test harness first (before function related code – not before acceptance criteria) forces both the domain expert and the developer to understand what s/he is supposed to create before they actually create the code, to a very low level of detail. And Test First essentially creates an evolving regression tests harness that is truly usable, fully automated, and readily available. The engineering teams that I am associated with have documented statistics that show a 1,500% improvement in code quality resulting from the consistent use of an automated regression tests harness. Test First, alone, can therefore improve the productivity of a development effort by this astounding 1,500% improvement level. What is really amazing is how few engineering teams developing multiple release software products also create automate tests harnesses. In the traditional waterfall development lifecycle, automated test harnesses are an after thought that almost never get built. And then the project teams are surprised at the number of defects found during the QA cycle (after development is supposed to be completed). This 1,500% improvement exemplifies the great value of the Test First tenet.

To bring this concept back to writing effective use cases in an iterative lifecycle, before one can employ Test First, one must write the acceptance test plan, which in a large complex project with geographically dispersed team members is derived from well written use cases.

Save the Acceptance Tests
One of the tenets of Agile methods is that User Stories are to be discarded. Before they are, the domain experts are held responsible for the creation of Acceptance Test Criteria (plans, scenarios, scripts and expected results). These are fed to the developer who creates a test harness (see Test First, above). This means that the "documentation" of "what" was supposed to have been built is held within the Acceptance Test Plan and confirmed by the results of the test harness.

In a typical Agile project, with domain experts and developers in very small teams and physically co-located, there are no worries about loosing requirements. For those of us developing products with larger geographically dispersed teams, the clue should be obvious, save the acceptance test plans; these represent a more complete and up-to-date set of the detailed user requirements then the originating use cases which the tests were derived from. And because more units are continuously integrated into the build, the acceptance tests are more likely then the use cases to be reused and updated.

Continuously Integrate
In the traditional methods the Use Case analysis dives deep into conceptual (abstract) concepts, and the domain expert is asked to specify all of the process, methods, data elements, their structure and source and behavior within all of the other Use Cases of the proposed system. There is a tenet of psychology that says the human mind can only retain seven, plus or minus two, concepts simultaneously. With this in mind, one can easily see how lost a development team can become if required to remember the details of a system with 100 Use Cases (which is not unusual). Continuous Integration helps to resolve some of this problem of use case complexity.

In the Agile methods, integration happens as soon as the developer attempts to check a developed object into the system repository. If upon check-in, any of the automated tests for previously checked-in objects fail, then the new object is in some way the identifier of the problem, and a fix must be completed before the object can be checked-in. The developer has the choice to either fix the object or reschedule the development effort (for that object) for another day – with all of the inherent schedule delay issues that would cause. With continuous integration, the complexity of a very large project can be held under control, even as the product grows and evolves, because no new objects are added to the system (aka, integrated) until all of the automated test of previously integrated objects pass successfully (regressively).

Measure Velocity
In a traditional method, there seems to be a lot of confusion about how to build a project schedule; with a great deal of wasted debate between deliverable based scheduling or tasks based scheduling. A transition to an iterative schedule based on completion of useful code objects, organized from a prioritized list of features (stories) should be easy to make. An object checked-in can clearly be checked-off as complete, since it is fully tested to the point of the system at its present level of evolution. What better way to know what use cases remain to be developed and which are complete?

The rate of completion within an iteration is the velocity, which provides the basis for planning the next iteration. It is important to re-plan the entire release along with each iteration plan. This focuses the team’s attention on what features to add next to the evolving product, rather then what administrative tasks are next (I’ve seen too many project plans where the critical path was comprised entirely of administrative tasks). The confusion of what deliverables or tasks which need to be combined to create the critical path is resolved.

Iterate on Priority
In a traditional method, it is normal to prioritize the use cases early in the project lifecycle and they typically remain in that same order throughout the lifecycle of the project. It is only when it is well understood that the project will be grossly late and some of the functionality must be cut out of the release plan (something no domain expert wants to do) in order to meet schedule commitments that it becomes understood that priorities have changed.

In Agile methods, the practice is to re-prioritize the list of features to be developed at the start of each iteration. In this way, if the schedule goes long, the features that may be cut from the release plan in order to meet the schedule commitment are the lowest priority features. Some may say that this is a plan that assumes failure. It is easy to forget that engineering estimating is often a rough science and that pre-calculating unforeseen problems is sometimes impossible – no matter the experience level of the engineering team or the depth of the historical database used in estimating. When those unforeseen events happen it is an advantage to be able to make the decision on whether or not to release the product on schedule, pushing some of the low priority features into the next release.

A General Manager once told me that he worried about getting all of the features into the next release. The iterative method, where features were left undefined until a future scheduled iteration, scared him into believing that some features would surely be left out of the release.

“We need all of these features!” he cried.
“Are the features being developed in priority order?” I asked.
“Yes, but low priority does not mean no priority,” he lamented.

Consider that 70% of large software projects across the software industry fail to meet their schedule, cost or business objectives. There are many reasons for this, and they should be address. However, software estimating is not an exact science. It is only prudent planning to work on the high priority items first.

Continuously re-prioritizing the features list and re-estimating based on that new priority, and then developing according to the new priority, preserves options when trying to meet schedule commitments. This is far better then grinding onward with a project, usually well beyond the planned delivery date, because some high priority features are not working yet (because they were not tackled until too late in the schedule). When this happens, and it happens too often, there are no options.

Conclusion
A primary tenet of the Agile methods is to maintain close collaboration between domain experts (the customer) and the developer; encouraging constant feedback. Each of the techniques described will facilitate feedback, and all are implement-able in an iterative project schedule using Use Cases – helping to make schedule success an achievable reality.
About the Developer
Ed Carroll
Sales Executive, Agilis Solutions

Ed has been building software products for more than 20 years, with particular expertise in automating economic analyses, decision support and supply-chain management processes. He is currently a sales executive with Agilis Solutions and has provided strategic technology leadership in roles such as the vice president of engineering for Egghead.com, director of technology at Nike and director of software engineering at Boeing.

Contact the author.



  Privacy Statement