Business Analyst Interview Question: What is the difference between a use case and a user story?
The use case
A use case provides a scenario based on requirements. Its purpose is to show an example of the requirements in action. It identifies all of the major actors, whether they are human actors or computer systems. The use case then walks through a business process from beginning to end, and notes the consequences of following the process through its conclusion. It may also note exceptions to the process, or may describe multiple process paths based on a decision point.
Suppose you have requirements for how a customer can order a pizza and have it delivered. What follows is a (highly simplified/incomplete) example of a related use case called PLACE PIZZA ORDER, which addresses only the ordering piece.
Customer calls the pizza restaurant. The order taking employee answers the phone. The customer may select a pizza from the menu he viewed online or may elect to build his own pizza. If he selects a pizza from the menu, the employee selects the item corresponding to the order on the computer system. If the customer wants to build his own pizza, the customer informs the employee about what toppings he wants; the employee then selects the item corresponding to “build your own pizza” in the computer system and then selects the toppings on the next computer screen. He gives the customer the final price. The employee takes the customer personal information and enters it into the computer system. He processes payment with the credit card processor. The employee uses the system to inform the customer of how long it will take to deliver the pizza based on his address. The customer hangs up. The employee submits the order to the kitchen.
The user story
A user story is a small sub-set of a use case. It is usually just a sentence or two. It adopts the perspective of one of the human actors in the use case, and tries to do just one thing. The format of a user story is often:
As a (kind of user), I want to (objective) so that (result.)
Here are some possible user stories based on the PLACE PIZZA ORDER use case:
- As a customer, I want to view what toppings I can add to a pizza online so that I can build my own pizza.
- As an employee, I want to enter the toppings a customer selects for “build your own pizza” so that I can give the customer the final price.
- From the perspective of an employee, I want to process the customer’s payment so that I can finish the order and send it to the kitchen.
- As an employee, I want to estimate the time for pizza delivery based on the customer’s address so that I can inform the customer.
When do you use a use case versus a user story?
A use case is kind of a “big bang” approach to software engineering. The expectation is to build or enhance a system that provides every function called for in the use case. Developers often build a solution using a so-called “waterfall“ development approach. This means that first you create all of your requirements, build one or more use cases, then build all of your code, then you test it all, and then you implement it all. Building use cases and coding software may happen over one or multiple releases based on schedule and available resources, but not usually based on the desire to build one small piece of functionality at a time.
There are risks with this kind of approach, where you try to do too much at once. The more complex your system is, the less likely that all functions will work exactly as expected. This can cause delays and cost overruns. But this is nevertheless how many organizations develop solutions to business needs.
User stories are important for a software development and project management methodology called “agile development.” Agile development employs the opposite approach from “big bang.” Instead, it seeks to build the solution one small piece (or a few small pieces of logically grouped functions) at a time. The development team builds each small piece during a short period of time, usually days or weeks. The team then iterates incrementally to build the next piece once it proves the previous piece works properly. User stories break down an overarching use case into manageable chunks, so that the developers can code one or a few of them at a time using agile.
How would you answer an interview question about the difference between a use case and a user story? Leave your thoughts in the comments!