Working with Requirements
In the preceding chapters, we discussed how to understand a domain and its language. We showed you how to find team and context boundaries. Sometimes, this is all that development teams need to jump directly into code. However, usually jumping from scenarios to code is a bit too challenging, and you need to bridge the gap between domain knowledge and requirements. We will show you how to derive requirements from domain stories so that you can discuss priorities and viable products.
This chapter is for you in the following cases:
-
You consider yourself one of the following:
-
Product owner
-
Product manager
-
Business analyst
-
Requirements engineer
-
Developer in a cross-functional team that does its own requirements analysis
-
-
You want to do any of the following:
-
Find out what the software you build should actually do
-
Add context to requirements
-
-
You work with either of the following:
-
User stories
-
Product backlogs
-
In this chapter, we will come across some software development terms and concepts that we will explain only briefly. For more details, please see the references provided. In particular, we will refer to these terms:
-
Agile/Scrum terminology: user story [ Cohn 2004 ], product owner , sprint , product backlog [ Rubin 2013 ]
-
User Story Mapping [ Patton 2014 ]
-
Use cases [ Cockburn 2001 ]
Stefan’s Call for Tenders Story
If a public institution in the European Union needs software, it can’t simply hire any company. It is obliged by law to call for tenders. That means the institution must write a requirements document. Companies can then submit a tender for the contract. Finally, one of the contenders is selected based on price, qualifications, and the proposed solution.
Some time ago, our company won such a tender. The requirements specification document amounted to 300 pages, describing (among many other things) 80 use cases. Personally, I am not a big fan of these kinds of documents. Since I have written one or two myself, I know that no matter how much skill and time go into them, they are always outdated, incomplete, and—to put it simply—wrong. Nevertheless, those 80 use cases were among the best I had ever read: They contained a main success scenario, variation scenarios, preconditions, primary actors, goals, triggers, and a lot of other useful information.
Our customer’s business analyst had done a great job, but as soon as we started working on the software, my colleagues and I realized that the use cases were not sufficient to really understand the domain. We did not know enough about the business processes and the context of the requirements.
At the kick-off workshop, I decided to pull Domain Storytelling out of my toolbox. I did this because the business process that we wanted to analyze was highly cooperative, involving multiple actors and systems. The customer’s team included the business analyst and about five domain experts who would later use our software. Together with two of my colleagues, I modeled three happy-path scenarios as MEDIUM-GRAINED , DIGITALIZED , AS-IS, domain stories. We were able to gain a better understanding of the domain. In particular, we understood the shortcomings of the existing solution, which motivated several of the requirements.
When we all met again about a month later, we were interested in the solution space. In a second round of Domain Storytelling, we used the same three happy-path scenarios as we did the first time, except that now we had the domain experts tell us about the TO-BE processes. Now, we got to understand the interplay of the use cases.
Another three months and several implemented use cases later, we had reached a point where we had to think about going live with the first release. Our customer had planned an incremental rollout—some users would switch to our new software, and others would continue to use the old software. To make that possible, we had to enable collaboration between the two software systems. We needed to design a collaborative, software-supported workflow, and again we chose Domain Storytelling for that purpose. This time, the scope was FINE-GRAINED , DIGITALIZED , and TO-BE . During the workshop, we realized that the newly designed, software-supported workflow was not backed by the requirements document. However, it was easy to derive new requirements from the domain story. Basically, we just had to transcribe the activities into text form.
Besides domain stories, we also used mock-ups and walk-throughs of implemented functionality.
By the way, our team grew by approximately one developer per month. Retelling the domain stories helped the new team members understand the domain. So, it became part of the team’s onboarding process. But that’s another story.
Software Development as a Series of Conversations
Building software does not mean a programmer sits alone in a dark room typing code into a computer. Instead, it is highly interactive and communicative. Over the whole life cycle of a software system, developers, domain experts, and other stakeholders talk to each other again and again. Of course, it involves typing code into a computer (though usually not alone and not in the dark), but this is only one part of the process, and it alternates with conversations. Coding is a conversation too: with the computer, with other developers (in the form of pair programming [ Beck 2000 ] or mob programming [ Zuill 2014 ]), and even with the developers who have to read the code in the future.
This series of conversations will make it clearer and clearer what is required from a system. We believe that working with requirements is not an objective, strictly analytical process. Descriptions of requirements such as text or diagrams are never “complete” or objectively “right.” Rather, we see them as something that the stakeholders involved create from their own perspective. As Christiane Floyd observes:
We do not analyze requirements; we construct them from our own perspective. This perspective is affected by our personal priorities and values, by the methods we use as orientation aids, and by our interaction with others. [ Floyd 1992 ]
For that to work, the stakeholders must align their perspectives, priorities, and values, at least to an extent that allows teams to produce artifacts. These artifacts—running software, mock-ups, paper prototypes, etc.—can be evaluated by the stakeholders, thus continuing the conversation. Different modeling methods are useful at several stages in this continued conversation, with Domain Storytelling being just one of them. The rest of this chapter illustrates how you can facilitate a conversation about requirements with the help of Domain Storytelling, user stories, and User Story Mapping.
Revisiting the Metaphor for Granularity
In Chapter 4 , “ Scope ,” we used Alistair Cockburn’s “goal levels” metaphor to describe the granularity of domain stories (see Figure 11.1 ). Cockburn originally developed this metaphor for use cases—a description format for requirements. In this chapter, we will use the metaphor for both domain stories and requirements. We think it fits in wonderfully with the idea of software development as a series of conversations. The different levels help to steer the discussion in the right direction.
Figure 11.1 Different goal levels
From Domain Stories to Requirements
Domain stories are a great medium for moving from a spoken conversation to a written requirement that is just formal enough to be planned, estimated (if you are into estimations), and implemented. However, we do not propose a strict top-down process of decomposing high-level requirements into low-level requirements. We think that such a “waterfall” approach would not work in the real world. A conversation about requirements may start COARSE-GRAINED and evolve to FINE-GRAINED , but it is not a one-way street. For us, software development is not a process in which first the requirements are defined and then the software is programmed, but a constant cycle of discussing the requirements and their constructive implementation.
In the following sections, we will present a step-by-step “recipe” to break down domain stories, mixing up different “ingredients.” Finally, we will apply the recipe to the Alphorn example.
A Recipe for Breaking Down a Domain Story
For our recipe we need some ingredients:
-
A method for finding functional requirements: Domain Storytelling
-
A method for writing requirements down: user stories
-
A method for organizing requirements: User Story Mapping
We assume that one team works on supporting a business process within a bounded context. Further, we assume that the team has access to domain experts.
Now you’re ready to begin.
-
The team models the business process as a MEDIUM-GRAINED to FINE-GRAINED domain story, starting with the most important scenario (usually, the happy path). PURE and DIGITALIZED TO-BE stories both work.
-
For every activity in the story, ask if it should be supported by the new software system. As a general rule of thumb, if an activity should be supported by IT, write a kite-level requirement for it. These requirements will become the backbone of your backlog.
-
Model alternative scenarios and, if necessary, more FINE-GRAINED domain stories. Collect information about exceptions, possible errors, edge cases, and so on as annotations.
-
Walk through the new domain stories and the annotations. Again, for every new sentence, write one requirement on kite level or sea level. Check your annotations—see which ones should become a requirement and write them down as well.
-
Organize the requirements by mapping the FINE-GRAINED requirements to the backbone, creating a user story map.
The team now has a structured backlog of kite- and sea-level requirements. The backlog will neither be complete nor are all the requirements ready for implementation. However, the team will have a sound understanding of the functional requirements and how they add up to a workable business process.
Next, we will look at the method for writing requirements down with user stories (steps 2 and 4 in the recipe) and the method for organizing requirements with User Story Mapping (step 5).
Writing Down Requirements as User Stories
Spoken conversations are vital to discovering requirements. Sooner or later, you will need a memory aid. Domain stories are a helpful tool, just like other diagrams, mock-ups, etc., but often a short text is the most expressive way to capture a conversation. There are many ways of writing such a text. Currently the most popular format is the user story .
Caution: user story sounds similar to domain story , but they are different things. It’s a bit like Java and JavaScript .
Please keep in mind that user stories are first and foremost oral conversations. To preserve the essence of such a conversation, people have followed simple templates, such as this one:
As a < type of user >, I want < some goal > so that < some reason >. 1
This schema is like a little checklist for the conversation. It also matches the structure of a sentence in a domain story:
As an < actor > I want to < activity plus work object > so that …
So, actor becomes type of user , and activity plus work object describes the goal . And where do we get some reason from? This “why” can sometimes be found in the annotations. Sometimes it is not directly in the domain story but comes from the conversations.
A user story should not be confused with a specification just because it can take written form. We cannot stress enough that a user story is a “promise for a conversation” [ Cockburn Origin ], meaning that the written text is a by-product and not a substitute for communication. This aspect is often neglected in practice and is one of the reasons that user stories are sometimes viewed critically.
Building a Backlog of Requirements with User Story Mapping
We already introduced User Story Mapping [ Patton 2014 ] in Chapter 7 , “ Relationship to Other Modeling Methods .” There, we briefly described how User Story Mapping guides you through a conversation about requirements. For us, Domain Storytelling plays this guiding role. However, we use User Story Mapping as a planning instrument for cross-functional, agile teams to do the following:
1 . There are many different templates for user stories; we chose a template popularized by Mike Cohn [ Cohn 2004 ].
-
Talk to a product owner about priorities and increments
-
Clarify which requirements need to be worked out in detail next
-
Never lose sight of the context of a user story
In the context of our “recipe,” we apply User Story Mapping as an additional “ingredient” after domain stories have been created. Typically, we start the User Story Mapping workshop by unrolling the sentences of a MEDIUM-GRAINED domain story (or stories) into what User Story Mapping calls the backbone : a series of user stories (about kite level), arranged in a timeline from left to right. This is the horizontal dimension of the user story map. It represents a business process or a user journey.
When the backbone is finished, it is time to move on into the vertical dimension, which is used to detail requirements and prioritize them. The high-level user stories are elaborated and refined through detailed user stories (sea level to fish level). MEDIUM- and FINE-GRAINED domain stories will help here. With the resulting user story map/product backlog, the product owner and team are ready to plan the next sprint.
Back to the Leasing Example
Let’s apply the recipe from earlier to Alphorn. We start with the team that builds the bounded context “offering.” For that purpose, we meet with developers Dave and Denise, and with Sandy, who represents the sales team (the experts for this context). They look at domain story Alphorn 1a from Chapter 10 , “ Finding Boundaries ,” again. They decide that their part in this story (see Figure 11.2 ) contains enough detail for deriving the backbone, so this serves as step 1 of the recipe (modeling a MEDIUM-GRAINED TO-BE domain story). They go on to step 2—creating the backbone.
Figure 11.2 The bounded context “offering” from Alphorn 1a
The first sentence in Figure 11.2 , “Customer chooses car from catalog,” is an activity that should be supported by the software system and thus becomes a kite-level requirement: “choose car.” We write it on a sticky note (see Figure 11.3 ).
Figure 11.3 A kite-level requirement for our user story map
We leave out “from catalog” for now, because it describes one of several ways of achieving this goal. “Choose a car from catalog” is already a sea-level requirement, so we write it down but put it aside until we arrive at step 4 of the recipe.
The workshop participants move on sentence by sentence. The team decides that the second sentence, “Customer asks for offer,” and the third sentence, “Salesperson offers contract for car,” can be condensed into one kite-level requirement: “offer contract.” The customer will still need to sign the contract (sentence four). Finally, the contract needs to be passed on for risk assessment. A backbone emerges, visualized as a horizontal sequence of sticky notes (see Figure 11.4 ).
Figure 11.4 Backbone of kite-level requirements
The team tries to develop the user story map further by modeling FINE-GRAINED domain stories for their bounded context. As always, we let our domain expert (in this case Sandy) tell their story. Denise takes the lead in modeling and discussion:
Developer Denise : “You offer a contract with a monthly installment, and the customer signs the contract. Can you please tell us what you are doing in more detail?”
Salesperson Sandy : “Last time, we started with what you called the ‘happy path.’ Do you want me to go back to the best-case scenario?”
Denise : “Yes, please.”
Sandy : “First, I take a contract form with a new contract number. I fill out the contract with the details of the car and its price.”
Denise : “I will model this as your first activity: ‘Salesperson fills out contract.’”
Sandy : “Now I am ready to calculate the monthly installment for the contract. I calculate it from price, term, and interest.”
Denise : “Step 2: ‘Salesperson calculates installment.’”
Sandy : “Finally, I offer the contract with all details to the customer. If they agree with it, they sign it.”
Denise : “I will model this as two steps—step 3 is ‘Salesperson offers contract,’ and step 4 is ‘Customer signs contract.’”
This conversation results in the domain story shown in Figure 11.5 .
Figure 11.5 Alphorn 6: Offering, happy path— FINE-GRAINED
Developer Denise : “You said if the customer agrees with the terms of the contract, they will sign it; what happens if they don’t agree?”
Salesperson Sandy : “They reject it, usually because the monthly installment is higher than they can afford. I then recalculate the contract with a longer lease term. The resulting monthly installment will be lower.”
Denise : “I’m going to model this as another story. I’ll start with a copy of the happy path. I will remove step 4 and replace it with ‘Customer rejects contract.’ Also, I will add a step 5, ‘Salesperson recalculates with different term.’”
Figure 11.6 shows the second FINE-GRAINED domain story.
Figure 11.6 Alphorn 7: Offering, rejection— FINE-GRAINED
Other variations are considered as well. For brevity’s sake we will omit them.
The last steps of the workshop with Denise, Dave, and Sandy are to derive more detailed requirements from the domain stories and to map them to the backbone. For that, we bring up the team’s user story map. The sentences in the more FINE-GRAINED domain stories lead to more fine-grained user stories. They are put on a second sequence of sticky notes, below the existing user stories they refine (see Figure 11.7 ).
Figure 11.7 Backbone for offering context
At an even more fine-grained level, the team adds user stories for different variations of the process. Finally, they come to a first product backlog for the “offering” context (see Figure 11.8 ).
Figure 11.8 Product backlog for bounded context “offering”
The team’s user story map contains requirements at different levels of detail. Note that the map shows only the names of the user stories—the actual story is written either on the back of the index card (if a physical whiteboard is used for mapping) or in a software tool. For example, here is the description for the user story “recalculate monthly installment”:
As a salesperson, I want to recalculate the monthly installment with changed parameters so that I can offer alternative contracts to my customers.
Adapt the Recipe
So far, we’ve described a basic recipe for working with requirements. Of course, you can (and should) adapt the recipe. As you have seen, we do that too. Besides the already mentioned “ingredients,” the following are worth considering:
-
If you find examples for business rules or “decision points” in the annotations, then Example Mapping can be the right tool to dig deeper. From there, FINE-GRAINED requirements with acceptance criteria and BDD scenarios can emerge. (See Chapter 7 , “ Relationship to Other Modeling Methods .”)
-
As an overview of actors and use cases, a UML use case diagram (see Chapter 3 , “ Scenario-Based Modeling ”) can help.
-
A written use case is a more elaborate alternative to user stories (again, see Chapter 7 ).
Limitations
This is not a book on requirements engineering, so we can’t cover everything there is to say about this important topic. But since we have written so much about talking to domain experts and users, we should also mention that there are limitations to this approach.
Don’t just blindly model what the domain experts tell you!
Domain experts are usually biased, especially when it comes to designing TO-BE processes. These are some limiting factors that we have come across:
-
Organizational structures and reward systems.
-
Domain experts may know little about technological innovations and the potential of modern software systems (and that’s OK because it is not their job).
-
The domain experts’ vision is limited by what they know, i.e., the current processes and software systems. Hence, they tend to overlook possibilities to re-invent business processes. Small improvements to an existing process are more likely as an outcome than a significantly changed process.
An observation made by John Ferguson Smart addresses premature solutions:
While users are happy to talk about solutions that they think will fix their problems, they rarely talk about the underlying problems they are trying to fix. After all, if users could always explain exactly what they needed, we wouldn’t need disciplines such as Product Management and Requirements Analysis. [ Smart 2017 ]
Smart goes on to say that what domain experts and users ask for is not what they get; and what they get is not what they need.
Also, consider this quote from the originator of DDD, Eric Evans:
Developers get the experts to describe a desired feature and then they go build it. They show the experts the result and ask what to do next. […] but if programmers are not interested in the domain, they learn only what the application should do, not the principles behind it. Useful software can be built that way, but the project will never arrive at a point where powerful new features unfold as corollaries to older features. [ Evans 2004 ]
In other words, communication with users is important for building the right software, but understanding the domain to the extent where development teams become (at least in part) domain experts is also crucial to building truly powerful business software.
What to Read Next?
Once your backlog contains requirements at sea level, they should be understood well enough that you can start implementing them. How domain stories can help you do this is the topic of Chapter 12 , “ Modeling in Code .”
Implementing the requirements typically has an impact on how the company does its work. Chapter 13 , “ Supporting Organizational Change ,” will show you how to deal with that.