Mastery 3 – Let’s talk about use cases

You have your product’s requirements, now what? Use cases are what you need. In this post, I’ll explain what use cases are and how to use them.

A use case tells you what your product does to meet a customer’s need. As Brett McLaughlin, Gary Police and Dave West wrote in their book Head First Object-Oriented Analysis & Design,

“a use case is a technique for capturing the potential requirements of a new system or software change. Each use case provides one or more scenarios that convey how the system should interact with the end user or another system to achieve a specific goal.”

Every use case has three essential things:

  • Clear Value
  • Start and Stop
  • External initiator

Clear Value: as I mentioned above, each use case must meet a customer’s need and thus a clear value. If one use case does not have a clear value, it will not be practical to write it.

Start and Stop: the use case is often a process with a description of each step, so as every process, it will always have a first step or a start and a final step, or a stop.

External initiator: someone has to get the use case steps going, and that is what we call the external initiator.

Everything is best explained with examples:

If you need to create a product that when you click a button, a lightbulb turns on, the requirements could be like this:

Requirements

  • The product must only have one button.
  • The product must emit warm light.
  • The lightbulb and the button must be 1ft apart.

Note: if you want to know more about requirements, check out this blog where i talked a little more about them: HFOOAD Chapter 2 – Give them what they want

 

Then you think about the process and create a use case or several use cases. The number of use cases is equal to the number of functions the product has.

Use case

  1. The customer wants to turn on a light.
  2. The customer clicks the button.
  3. The lightbulb turns on.

This is a simple use case, but can help us understand how it works. We can recognize the three essentials of the use case:

Clear value: the customer wants to turn on a light and that is exactly what the use case achieves. So it has a clear value.

Start and Stop: it starts when the customer clicks the button and ends when the lightbulb turns on.

External initiator: the external initiator is the customer, because it is foreign of the process and gets the process going.

Use cases can help us identify mistakes and values of the system, to make room for improvement. They are very simple but very powerful and will ensure your system does what it is supposed to do.

References

McLaughlin B. , Pollice G., West D. (2006). Chapter 2 Give Them What They Want. On Head First Object-Oriented Analysis and Design: A Brain Friendly Guide to OO&A (640). O’Reilly Media.

Other explanations

I made another blog post where I covered the chapter of the book Head First Object-Oriented Analysis & Design where use cases are mentioned and described: HFOOAD Chapter 2 – Give them what they want.

Also, if you want to turn your use case into use case case diagram, check out this awesome video from Lucidchart:

Leave a comment