Feeds

Use case style means handbags at 30 paces

Style is all that matters

Securing Web Applications Made Simple and Scalable

In February, I wrote a Reg Developer article which caused some consternation. The article's message distils down to: Don't write vague use cases, write concrete, specific use cases that leave nothing to the imagination instead. Controversial stuff.

head shot of Matt Stephens smiling

Matt Stephens.

It turns out, I believe, that use case style hides a miasma of strong feelings and conflicting opinions far in excess of anything seen in the programming world.

Programmers have it easy: curly brace positioning, level of commenting, variable naming style etc. The Great Napoleonic Curly Brace Positioning War of 1803 was a schoolyard tussle compared with the political infighting that goes on around how to write use cases.

There are some elements of use case style that can seem important, but which ultimately don't make a shred of difference (except to slow the project down while everyone bickers) - like whether to structure your use case in the "narrative paragraphs" or "numbered list of steps" styles, or whether to link your use cases using "includes", "extends", or "invokes" stereotypes.

But there are some elements that really do matter, because they affect the ease with which the developers will be able to interpret your specification. Here are a few of them:

Active versus passive voice: Here's a passively worded description: "The capability is provided for users to log in, using a password-protected authorisation scheme." And here it is in active voice: "The user enters her username and password, and then clicks the Login button. The system looks up the user profile using the username and checks the password. The system then logs in the user."

If you write your use cases in active voice, you'll find that you write less ambiguously, and you'll prevent your reader from falling asleep face-first in her double chocolate chip muffin, which she'll thank you for.

Functional versus behavioural descriptions: Use cases are behavioural requirements specs, each one describing a user's interaction with the system. Mixing in functional requirements ("The system shall be capable of detecting intruders by their typing speed") is a common malpractice. Of course, functional requirements do have their place, but that place isn't in your use case descriptions.

How many 'rainy day' scenarios is enough? Ten. Three. One hundred. Of course, there is no magic number. The correct number of rainy day scenarios is simply when you've brainstormed and quizzed the end-users and can't think of any other variations or ways in which the 'sunny day' scenario could go wrong.

Comprehensive versus Minimal Templates: What else can we add to our template? Preconditions, post-conditions, scope, minimal guarantees, level, context of use... The list of fun and entertaining subheadings to add to your template is endless. But keep in mind that the more "blanks" you add that need to be filled in for each use case, the longer each use case will take to write; and, the less bang for your buck you'll get out of them.

Whether to reference domain classes by name: By domain classes I mean names for real-world or problem domain objects referenced in the project, e.g. trade, ledger. Some analysts feel that even this level of detail is too concrete for a use case.

Whether to reference UI elements (screen/page names, buttons etc.): This particular piece of religious touch paper is the catalyst for much of the disagreement about the purpose of use cases; so I'll return to this subject in my next article.

With some style elements, most people will agree wholeheartedly that there's a right and a wrong way to write them. Just no one can really agree on what's right and what's wrong. Check back in a couple of weeks... ®

head shot of Matt Stephens smiling Matt Stephens is the co-author, with Doug Rosenberg, of Use Case Driven Object Modeling with UML: Theory and Practice.

Bridging the IT gap between rising business demands and ageing tools

More from The Register

next story
NO MORE ALL CAPS and other pleasures of Visual Studio 14
Unpicking a packed preview that breaks down ASP.NET
DARPA-derived secure microkernel goes open source tomorrow
Hacker-repelling, drone-protecting code will soon be yours to tweak as you see fit
Cheer up, Nokia fans. It can start making mobes again in 18 months
The real winner of the Nokia sale is *drumroll* ... Nokia
Put down that Oracle database patch: It could cost $23,000 per CPU
On-by-default INMEMORY tech a boon for developers ... as long as they can afford it
Google shows off new Chrome OS look
Athena springs full-grown from Chromium project's head
Apple: We'll unleash OS X Yosemite beta on the MASSES on 24 July
Starting today, regular fanbois will be guinea pigs, it tells Reg
HIDDEN packet sniffer spy tech in MILLIONS of iPhones, iPads – expert
Don't panic though – Apple's backdoor is not wide open to all, guru tells us
prev story

Whitepapers

Designing a Defense for Mobile Applications
Learn about the various considerations for defending mobile applications - from the application architecture itself to the myriad testing technologies.
Implementing global e-invoicing with guaranteed legal certainty
Explaining the role local tax compliance plays in successful supply chain management and e-business and how leading global brands are addressing this.
Top 8 considerations to enable and simplify mobility
In this whitepaper learn how to successfully add mobile capabilities simply and cost effectively.
Seven Steps to Software Security
Seven practical steps you can begin to take today to secure your applications and prevent the damages a successful cyber-attack can cause.
Boost IT visibility and business value
How building a great service catalog relieves pressure points and demonstrates the value of IT service management.