Delivering Valuable Software through Use Case Driven Development
Valentina (Cupa?) Jemuovi?
TDD in Legacy Code | Hexagonal & Clean Architecture | I help Technical Founders & Engineering Leaders deliver software products faster by coaching development teams in TDD, Hexagonal Architecture and Clean Architecture
Why are we building software??
At the end of the day, we’re delivering software to satisfy user needs so that the user can achieve some goals which are valuable to them. But how do we know what the user actually needs? The short answer is, we don't truly know. However, we have techniques to help us approximate what the user needs, and then by delivering software iteratively we can validate whether we’re meeting user needs (and then make adjustments).
This was one of the key motivations for agile development - after all, the first principle of the Agile manifesto is "Our highest priority is to satisfy the customer through early and continuous delivery of valuable software." The key words are: early, continuous and valuable.
Previously I wrote about the importance of understanding the business domain when building software (https://www.dhirubhai.net/pulse/3-ways-increase-productivity-software-development-teams-cupa%C4%87/ ). This is a follow up article which helps us understand the business domain through the eyes of the user.
User Stories
User stories are a tool which helps us satisfy the customer and deliver value, by describing, from the user perspective, WHAT the user the user wants to do (the tasks that the user wants to perform) and WHY (the goal they are trying to achieve). User stories are a one sentence specification written in natural business language, so that they are understandable by the business side. This avoids long documentation which no one wants to read, and it helps to ensure good understanding between the Customer and the Product Owner.
Template for writing a user story is:
An example is:
For further references, see https://www.atlassian.com/agile/project-management/user-stories
It should also be noted that a user story should fit within a single sprint. If it doesn’t then it becomes an epic and needs to be broken down further into multiple user stories. This is crucial to help us achieve earlier delivery.
Acceptance Criteria
As you’ve noticed above - the user story is very high level, informal, and doesn’t tell us any details - instead, it just opens up many questions and ambiguities. This is why Acceptance Criteria comes in handy, in drilling down the User Story the user story becomes more clearer. Acceptance Criteria specifies what we’re trying to achieve - the conditions under which a user story is fulfilled. Whereas Definition of Done (DOD) is a general criteria which has to be satisfied by all User Stories, Acceptance Criteria specifies conditions for a specific User Story - nonetheless, most must be satisfied.
Acceptance Criteria helps add feature scope details, sets scope boundaries, it describes not only positive scenarios but also negative scenarios. When Acceptance Criteria is well defined, then it clarifies understanding, enables better estimations and streamlines acceptance testing. It makes it clearer to developers what they need to develop, as well as more clearer to testers what they need to test.
The two most common formats for writing Acceptance Criteria is: scenario-oriented and rule-oriented (though other custom formats may also be used if appropriate). The scenario-oriented way is helpful for defining scenarios for manual and automated testing. The rule-oriented way is useful in cases where scenario-oriented way doesn't naturally fit, for example in specifying some system functionality or system constraints.
Further reading:
Scenario-oriented Acceptance Criteria
The form for scenario-oriented Acceptance Criteria follows the [Given / When / Then] format from Behavior Driven Development (BDD).
Examples are as follows:
Scenario: Customer orders pizza during pizza shop working hours
Scenario: Customer orders pizza outside of pizza shop working hours
Rule-oriented Acceptance Criteria
Rule-oriented Acceptance Criteria can be used to specify certain attributes for system functionality or anything else which is not easily specified by the scenario-oriented way.
The format here is just a series of bullet points.
Examples are:
Use Cases
In the above section, we went through writing User Stories and Acceptance Criteria. The user Story was an informal description of a user’s intended action and the goal that the user is trying to achieve, whereas Acceptance Criteria added some more details to “flesh out” the User Story.
Use Cases help describe to developers HOW the system should behave (aka the functional requirements of the system) in a way that is more formalized than User Stories. Thus, unlike User Stories, Use Cases tend to go into detail regarding functional behaviour., and are useful in modelling processes.
Template for a Use Case is:
Example is:
Main path:
Alternate paths:
Exception paths:
Here are some articles for further reading regarding use cases:
User Stories vs Use Cases
User Stories and Use Cases have the same goal but they are not interchangeable. They both convey information about users/actors and the goals that those users/actors are trying to accomplish. But the point where they differ is as follows:
It’s a cost-benefit trade-off whether to use just User Stories or to use them in Conjunction with Use Cases.
For further reading about User Stories and Use Cases:
Documenting Requirements in JIRA vs Confluence
Some teams use JIRA for writing User Stories, whereby a JIRA ticket is used both for specifying the User Story as well as for managing the status of the ticket.
Other teams write all requirements in Confluence (for example, using the Product Requirements template in Confluence or custom templates) which contains the User Stories and all associated details, whereas JIRA is used just for managing statuses.
I’ve used both these ways on various projects, though for the last several years I tend to prefer Jira for User Stories and Confluence for Use Cases.
Use Case Driven Architecture, Development and Testing
Thinking from the perspective of the user leads us to “pragmatic” architectural and design decisions.
Delivering Valuable Software
To summarize, thinking from the user is a mindset which helps us focus on the ultimate goal - delivering value to customers by meeting the user's needs. User Stories and Use Cases are mechanisms which enable us to capture requirements in an effective way so that developers can write the “right” software, decrease development time, decrease miscommunication, decrease bugs, and overall help us to deliver valuable software iteratively.