Chapter 2

Exploring with Examples

As we said in Chapter 1, “Focusing on Value,” the first and most important part of BDD is exploring desired system behavior with examples in conversations.

We set the stage for conversations around examples by finding valuable slices of functionality on which to focus in the form of MMFs and user stories. In this chapter, we look at how to explore the behavior of a new user story by collaborating around examples with a cross-functional team.

BDD Is a Cooperative Game

In Alistair Cockburn’s book Agile Software Development: The Cooperative Game, he characterizes software development as a “cooperative game of invention and communication.” In competitive games, like tennis, there is a clear notion of winning and losing. Even in team games, like basketball, one team wins and the other loses. But in cooperative games, people work to win together.

Games can also be finite or infinite. A finite game, like chess, is one that intends to have an end. On the other hand, an infinite game, like the game an organization or nation typically plays, is about prolonging one’s existence.

Games can be finite and goal-seeking, like chess, or they can be finite and nongoal-directed, like jazz, where the process is the focus—there’s not a defined goal that would cause you to “win” the song.

If we combine these ideas to get a goal-seeking, finite, cooperative game, we see activities like rock climbing or adventure racing, where a group of people work together to reach a goal together as fast as possible. Software development, especially Agile software development, is a similar game. Software development is a finite, goal-seeking, cooperative, group game.

BDD is an Agile subdiscipline of the game of software development. The emphasis in BDD is particularly placed on helping the team cooperate, innovate, and communicate during the game, all with the intention of achieving the goal of creating valuable working software more quickly and effectively.

BDD Is a Whole Team Thing

Teams who find their way into BDD via a tool like Cucumber often get the misunderstanding that BDD is a test automation approach that mostly concerns testers and developers.

BDD is a whole-team practice. It’s a way of structuring the collaboration required to build the right software. As such, it involves all the roles on the team.

Product owners bring an understanding of the customer and realistic examples of a user doing something with the software. Testers bring their unique perspectives about what could go wrong; they’re great at proposing examples outside the happy path. Developers understand the implications of a particular example on implementation and often have a good understanding of the existing system and the problems it solves. Technical writers contribute skills with language and often empathy for how users talk about what they do in the system.

Early in adopting BDD, collaboration tends to occur as a whole team. This allows the team to build a common language for their domain. Later, smaller groups can leverage that language to collaborate, and the work they produce will be comprehensible to the rest of the team.

Because we see so much value in the whole team participating in the collaboration in BDD, we rarely teach public BDD classes. If only some team members understand how to work in this way, the team is unlikely to experience the benefits. We’ve seen cases where just the testers or just the developers get excited about a tool like Cucumber and just end up doing test automation, the least valuable part of BDD, in isolation.

Allow Time and Space to Learn

Did you notice how Jonah warned the team it wasn’t going to be easy? Adopting a new way of working takes time and practice. It takes a willingness to muddle through until the new skills become natural. It’s easy to forget what we went through to adopt our current skills—they weren’t always as natural as they seem now.

Sometimes it feels like you can’t afford the time to learn something new. Maybe someone committed you to deliver a big project (with defined scope) by a particular date, and it doesn’t feel like you have any room to slow down. In that case, feature mining from Chapter 1 is your secret weapon.

These big release or project commitments that feel so fixed and overwhelming are usually fairly high-level. We know we have to deliver, say, the new sales reporting by June 15. But within the bullet point of “new sales reporting,” there’s high-value work and there’s low-value work. Feature mining gives us a way to focus on the high-value work and avoid the low-value work, thereby making the deadline less scary and buying some extra capacity for improvement.

We also don’t recommend adopting a new practice like BDD for all your work all at once. Instead, we recommend you use what we call the “slow lane” approach. Say you’ve planned eight user stories in your sprint. Most stories will use your existing definition of done, which doesn’t include BDD. Choose one or two to be in the “slow lane” across your board (see Figure 2-1). For those, you’ll use the new practice. And you won’t feel as pressured when you do it because you’ve already agreed those will take longer.

A figure shows a task board with two stories designated as slow lane stories.

Figure 2-1 A task board with two stories designated as slow lane stories

The early adopters on your team who are excited about the new practice will tend to sign up for those stories, working out the issues and establishing patterns for those who prefer to “wait and see.”

After a while, expand the slow lane to three or four stories. Eventually, you’ll notice that the stories with the new practice really aren’t that much slower (and probably turn out faster in the end because they have fewer defects and less rework). At that point, make the new practice part of your definition of done for every story.

Some teams move from the slow lane to fully adopting BDD in just two or three sprints. Others take their time and do it over four to six months. There’s no rush. It’s better to adopt a practice slowly, deliberately, and well than to rush into it badly and give up under pressure.

Flesh Out the Happy Path First

It’s often easy to come up with a bunch of examples right away, but we recommend talking all the way through at least one core example before getting deep in variations. By talking through a “happy path” example, a common case where things work as they should, the team gets a shared understanding of what the user story is about. What does it look like when the user is able to do what they want to do?

This complete slice also helps validate the story. Sometimes a story that sounds quite reasonable in the abstract reveals mistaken assumptions when you get into a core example. “Wait a minute,” someone says, “no user would actually do it that way.”

Once everyone understands the happy path, it often becomes more clear which variations are reasonable and likely. Instead of brainstorming every possible variation and edge case, realistic examples float to the top and focus the team on getting to value quickly. (The less likely variations and edge cases can be useful for exploratory testing, by the way. More on this and how it relates to BDD in Chapter 3, “Formalizing Examples into Scenarios.”)

Use Real Examples

Notice the team’s happy path example wasn’t just about “a book” or “Title ASDF”; it was an example of a real book that a real library patron might borrow. Good examples put you in the user’s shoes, building empathy for what the user is trying to do and helping you think more accurately about how they’ll do it.

It wasn’t a coincidence that using Words of Radiance for the example led the team to realize they already had test data to use. A real example connected the team to the system full of real inventory they already had at the library. This is not unusual. One real thing connects to other real things. We frequently see teams make discoveries about functionality, design, and architecture when they get into concrete, realistic examples.

Example Mapping Gives the Discussion Structure

Our favorite way to add some light structure to this kind of discussion is with Matt Wynne’s Example Mapping technique.1 In Example Mapping, the group builds a tree: the story has rules that are illustrated by examples. Assumptions and questions are captured on the side so the core discussion about examples doesn’t get blocked by side conversations. The result looks something like Figure 2-2.

A figure shows an Example Mapping that includes a story with three rules (each with examples). Questions are shown beside the story.

Figure 2-2 Example Mapping

Discussions about examples necessarily lead to rabbit trails—side topics that could distract from the core topic—because reality is complex and interlinked. In the meeting we just looked at, the team allowed side topics to naturally emerge but retained focus on the core topic with a facilitation tool called a parking lot. The parking lot is simply a place to capture things that are worth talking about but not right now.

In Example Mapping, pink stickies typically function as the parking lot—the questions and assumptions that otherwise might take over the discussion. But yellow, green, or blue stickies could capture stories, examples, or rules to be included in a future discussion.

Jane captured a note about audiobooks, for example. Audiobooks were explicitly out of scope for the current feature, but they were worth thinking about. Mark will probably take that note, convert it into a product backlog item, and prioritize it appropriately.

Using a parking lot balances the needs to be open to diverse contributions and to capture important discussion topics with the need to respect meeting participants’ time by keeping the meeting focused. We use variations on this technique in almost everything we facilitate.

Optimizing for Discovery

You might be surprised that the team proceeds with work on this user story before nailing down all the rules and examples. Rather than working in a series of phases— planning, analysis, development, testing—the team is working iteratively in very small cycles. They’re planning and analyzing a little, doing some test design, developing some production code, doing a little more testing, going back to planning, and so on.

The traditional approach to software development assumes we not only have a clear understanding of the goal of a software system but also the means to achieve that goal, and that we know both well ahead of when the software needs to be delivered to the customer. This implies that there is no need to further explore the customer’s space, since we already know what the customer requires. The waterfall development process is the logical outcome of this kind of thinking: the means of accomplishing the goal are called requirements, and all that is needed is for us to implement the requirements as software features. In industrial work, we want to manage for consistent, repeatable, predictable results; we want our goals to be as clear and unambiguous as possible. Waterfall development takes the same approach as industrial work.

In knowledge work we need to manage for creativity. We are generating something new rather than just incrementally improving on the past. This means there is no way to precisely define the goal in advance, because there are too many unknowns. Software development is knowledge work, and Agile development is fundamentally a considered response to this situation of not knowing the exact goal and how to reach it. Agile promotes embracing and adapting to change to be the chief concern of the development process. Thus, teams doing Agile development optimize for discovery, as the Manifesto for Agile Software Development says, valuing “responding to change over following a plan.” Furthermore, “Agile processes harness change for the customer’s competitive advantage.”

This ability to respond quickly to new learning is thus at the heart of agility in software development. “The path to the goal is not clear, and the goal may in fact change.”2 An Agile team will often start out with the intention of solving a customer’s problem in a certain way but discover their assumptions about that customer need are wrong. They might discover that the real need is actually different from what they thought, which then leads to a very different solution.

There is no such thing as “requirements”; there are only unvalidated assumptions. The goal of delivering MMFs is to validate our assumptions as soon as possible, in case they turn out to be false and we need to change direction. Agile development assumes that the specific destination is unknown, so we need to iterate our way there. Software development is inherently a discovery process.

In knowledge work we need to imagine a world that doesn’t exist yet and embrace exploration, experimentation, and trial and error. We are bringing fuzzy goals into reality. A fuzzy goal is one that “motivates the general direction of the work, without blinding the team to opportunities along the journey.”3 This is the journey we hope to demonstrate in this book, as the library development team adopts BDD and employs it to enable them to get better at delivering predictably in the face of fuzzy goals. “Fuzzy goals must give a team a sense of direction and purpose while leaving team members free to follow their intuition.”4

Addressing Some Concerns

Treat Resistance as a Resource

If you’re reading this book, you’re likely to be an advocate for BDD on your team, which means you’re likely to run into resistance from other people who aren’t as excited about the change.

You might see that resistance as something you need to fight against to successfully adopt BDD on your team. Or you might write it off as just “resistance to change.” We’d like to suggest an alternative: Gratefully accept that resistance as a useful resource.5

For the most part, people don’t actually resist change per se. People make changes all the time—and that person you think of as “resistant to change” would eagerly change many things in their life if they were to win the lottery. But people do resist particular changes, changes where they don’t, for whatever reason, see a likely net positive outcome. This means that when you encounter resistance, you have an opportunity to learn something that might improve your proposed change. When someone resists your proposed change, ask yourself, “What do they know that I don’t know?”

To answer that question, we’ve found it useful to think in terms of different layers of resistance, or layers of buy-in, based on a model from Eli Goldratt’s Theory of Constraints. There are several different formulations of this, with different numbers of layers, but we like Dr. K. J. Youngman’s:

  1. We don’t agree about the extent or nature of the problem.

  2. We don’t agree about the direction or completeness of the solution.

  3. We can see additional negative outcomes.

  4. We can see real obstacles.

  5. We doubt the collaboration of others.6

Start at the beginning of the list and look for where the resistance begins. Maybe the person agrees there’s a problem to solve but they’re not convinced your proposal actually solves it. Find out what they know about the solution; perhaps they’ve seen something similar in the past that didn’t work. You might be able to learn something from that failure. Or, you might be able to persuade them that this solution is different.

Maybe they agree the solution will work but they also see potential side effects. Again, what do they know that you don’t? Perhaps you need to add something to your proposed change to mitigate the side effects.

In the previous conversation, Jonah engaged Sam to explore Sam’s resistance. Sam had three main objections, all at level 3:

  • BDD will cause us to spend too much time in meetings.

  • Feature files will have to change too often.

  • My role will be marginalized or unappreciated in this new approach.

Notice that Sam wasn’t objecting that things were fine and there was no need to change (level 1) or that BDD wouldn’t solve their problems (level 2). He was saying that, even if it worked, BDD would cause negative side effects. So, Jonah engaged Sam in conversation about those potential side effects and how to prevent or mitigate them. Had Jonah focused on the problem and how BDD would solve it, he wouldn’t have won Sam’s willingness to participate in the experiment. Sam might even have worked against the experiment. But because Jonah heard and engaged Sam’s concerns, Sam’s on board and his feedback can help make the experiment stronger.

One pleasant surprise with this approach to resistance is how often the person putting up the biggest resistance becomes the biggest supporter of the change once you listen to them and incorporate what they know.

Playing the BDD Game

Jonah introduced the idea that BDD, like Agile, is a cooperative game. Let’s dig in to some of the practical implications of this as we think about exploring examples. The book Gamestorming presents the idea that every game has a common shape. This shape has three different stages, and each stage has a different purpose. This shape looks like that shown in Figure 2-3.

A figure illustrates a game design.

Figure 2-3 Game Design

In a game, a team wants to get from their known point A to fuzzy goal B, but they don’t know how. So they apply this game framework to get there. We believe BDD includes this kind of game, with the same structure and accompanying mindsets. BDD is so much more than just this collaborative game, but this aspect of BDD is typically the hardest part for most teams to understand and master. Let’s look at the three stages of the game structure.

Opening

The opening phase of the game is all about opening people’s minds, opening up possibilities and ideas for later exploration. The opening is divergent, as illustrated in Figure 2-4. Generating new ideas is maximized and all critique is deliberately set aside. It’s about getting as many ideas out in the open as possible and avoiding critical thinking and skepticism.

A figure shows a Divergent Opening.

Figure 2-4 Opening (Divergent)

The opening stage in BDD involves brainstorming examples that help the team understand the business domain. These examples are focused on the customer experience and are as close as possible to the reality of the business domain. The goal is to generate a variety of examples that help the team understand the business domain and the customer need they are trying to address. Some teams split into pairs or triads to maximize the diversity of perspectives and ideas. This stage may take only a few minutes or much longer, depending on the complexity of the domain being considered.

Exploring

The keyword for the exploring stage is emergent. Exploration and experimentation are the focus. You want to create the conditions where “unexpected, surprising, and delightful things” emerge.7 Figure 2-5 illustrates the nonlinear, emergent nature of the exploring stage.

A figure illustrates emergent exploring stage that shows five circles with two to five dots in each circle. Arrows are drawn from one dot to another dot.

Figure 2-5 Exploring (Emergent)

In BDD, this stage builds on the energy and ideas that flowed into the room during the previous divergent stage, exploring the examples generated to see patterns and missing concepts and scenarios. If the team split into subgroups, this is when the subgroups each take turns presenting their findings to the rest of the team, then the team looks for patterns, misunderstandings, missing concepts, and themes in the examples.

The exploring stage can feel chaotic, directionless, and confusing to those not used to it. Thus, this stage can be very uncomfortable for teams that aren’t used to exploring in this way. One facilitation book, the Facilitator’s Guide to Participatory Decision Making, even refers to the exploring stage as “The Groan Zone,” because the creative tension necessary for this stage takes effort to maintain and is discomforting for those not used to it.

Because of this tension, in the exploration stage of the game the temptation to critique options and converge on solutions as soon as possible can be very strong. If this happens, it can mean an early death to creativity, but this “groan zone” is a vital, normal, and necessary part of the creative process. Sam is used to formalizing proposed solutions early, which makes the exploration stage a big part of why he felt so uncomfortable playing the BDD game.

The right thing to do in exploration is to keep the creative tension and suspend judgment as long as necessary. This enables a team to pursue full participation, mutual understanding, inclusive solutions, and shared responsibility. We saw Jonah do this with the team, supporting and encouraging active dialogue about the various scenarios while not being afraid to dig a little deeper when necessary.

As we saw with the team, being very concrete is critical at this stage: who the user is in terms of background and experience, what they’re trying to accomplish, what struggles they might have in getting their need met, where they are, and so on. All these kinds of details might seem quite incidental and unimportant, but they are vital in helping everyone visualize each scenario and identify what’s missing, which then helps the team see other scenarios.

The focus in the exploration stage is on integrating the various ideas and perspectives rather than critiquing them. This is where the whole is greater than the sum of the parts. The team may analyze certain examples and discard them, or at least postpone further discussion on them. They may discover other examples that illuminate the domain more, and thus are pursued further. The team talks together about each example to make sure they understand it, filling in missing pieces and making note of things requiring further investigation.

Closing

The closing stage is where a game converges on conclusions, decisions, and action. It’s finally the time to bring in critical thinking and rigor, evaluating which ideas are the most promising to pursue and worth an investment of time and energy. The keyword for this stage is convergent, as illustrated in Figure 2-6. It’s about narrowing the field “in order to select the most promising things for whatever comes next.”

A figure shows a convergent closing.

Figure 2-6 Closing (Convergent)

For the BDD “game,” this means converging on a decision about which examples to carry through the rest of the BDD process. It involves starting to formalize the scenarios, looking for which details are significant and which are incidental. This leads us naturally to returning to our team in Chapter 3.

As we stated earlier, playing the BDD game is fundamentally about intentional discovery and growing a shared understanding. The overall BDD game structure looks like that shown in Figure 2-7, with divergent, emergent, and convergent stages.

A figure shows BDD game structure, consists of square and triangles structure as illustrated in game design. The figure shows divergent opening, emergent exploring, and convergent closing. The figure with a new point at the opening, and the decision point is shown after the convergent closing.

Figure 2-7 BDD game structure

Summary

  • BDD is a collaborative game of exploring the desired behavior of a software system.

  • People with different roles—usually product owner, developer, and tester—use examples to emerge this behavior rather than one individual trying to specify the behavior up front in isolation.

  • Example mapping is a good technique for structuring a discussion around examples.

  • Use real, concrete examples, not unrealistic dummy data.

  • Use a common or happy path example to get to work on a real, concrete thing right away. Come back later to handle variations rather than trying to fully specify a story up front.

  • Not everyone will be on board with trying a new way of working. Treat resistance as a resource, a source of information to engage rather than something to fight or avoid.

  • Games like BDD have a natural structure—opening, exploring, and closing. Don’t rush through the stages.

References

Cockburn, Alistair. Agile Software Development: The Cooperative Game. Boston: Pearson Education, Inc., 2007.

Emery, Dale H. “Resistance as a Resource.” http://dhemery.com/articles/resistance_as_a_resource/

Gray, David, Sunni Brown, and James Macanufo. Gamestorming: A Playbook for Innovators, Rulebreakers, and Changemakers. Sebastopol, CA: O’Reilly, 2010.

Wynne, Matt. “Example Mapping”: https://docs.cucumber.io/bdd/example-mapping/

Youngman, Dr. K. J. http://www.dbrmfg.co.nz/Bottom%20Line%20Agreement%20to%20Change.htm

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.157.45