Feeds

Model use cases that work

Think succinct

The Power of One Brief: Top reasons to choose HP BladeSystem

Use case modeling in practice

Here's an exercise from the book, on opening an account. See how many errors you can spot in the following use case, and try to rewrite the use case text - hint: this relates back to the items numbered 10 and three in our list. Once you're done, compare your rewritten version with our "fixed" version. Good luck!

BASIC COURSE: The system displays the Create New Account page and enters the following fields: Username (must be unique), password, confirm password, first name, last name, address (first line), address (second line), city, state, country, zip/postal code, telephone number, and e-mail address. Then the user clicks the Submit button; the system checks that the Username is unique, creates the new user account, and displays the main Hub Page, along with a message indicating that the user account is now created and logged in.

ALTERNATE COURSES: Password and Confirm Password don't match: The page is redisplayed with a validation message.
Username not unique: The page is redisplayed and the user is asked to choose a different username.

What's wrong? Answer: This use case gets bogged down in presentation details. It spends too long listing the fields to be found on the Create New Account page, with the result that the text doesn't follow a noun-verb-noun sentence structure.

Padded-out use cases of this sort often take up much more than two paragraphs. This doesn't help, as you want your use case to be succinct enough to translate to a single sequence diagram. We'll come back to this point in the fourth and final part of this series.

Instead, the fields should be added as attributes to the appropriate class in your domain model - most likely the Customer class. Then, when you need them later, they'll be right there. The fixed version follows.

BASIC COURSE: The system displays the Create New Account page and enters the fields to define a new Customer account. Then the user clicks the Submit button; the system checks that the Username is unique, creates the new user account, and displays the main Hub Page, along with a message indicating that the user account is now created and logged in.

ALTERNATE COURSES: Password and Confirm Password don't match: The page is redisplayed with a validation message.
Username not unique: The page is redisplayed and the user is asked to choose a different username.

In this excerpt we covered how to write the kinds of use cases that can be used to drive a software design. In the next installment we tackle robustness analysis, a form of preliminary design that helps to prepare your use cases for detailed design, testing and coding.

Use Case Driven Object Modeling with UML: Theory and Practice is available for purchase through Register Books, at the special price of £34.99. ®

The Essential Guide to IT Transformation

More from The Register

next story
Secure microkernel that uses maths to be 'bug free' goes open source
Hacker-repelling, drone-protecting code will soon be yours to tweak as you see fit
NO MORE ALL CAPS and other pleasures of Visual Studio 14
Unpicking a packed preview that breaks down ASP.NET
KDE releases ice-cream coloured Plasma 5 just in time for summer
Melty but refreshing - popular rival to Mint's Cinnamon's still a work in progress
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
Another day, another Firefox: Version 31 is upon us ALREADY
Web devs, Mozilla really wants you to like this one
Google shows off new Chrome OS look
Athena springs full-grown from Chromium project's head
Mozilla keeps its Beard, hopes anti-gay marriage troubles are now over
Plenty on new CEO's todo list – starting with Firefox's slipping grasp
prev story

Whitepapers

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.
Consolidation: The Foundation for IT Business Transformation
In this whitepaper learn how effective consolidation of IT and business resources can enable multiple, meaningful business benefits.
Application security programs and practises
Follow a few strategies and your organization can gain the full benefits of open source and the cloud without compromising the security of your applications.
How modern custom applications can spur business growth
Learn how to create, deploy and manage custom applications without consuming or expanding the need for scarce, expensive IT resources.
Securing Web Applications Made Simple and Scalable
Learn how automated security testing can provide a simple and scalable way to protect your web applications.