Chapter 1

Focusing on Value

This book is about the practices and skills that get a team collaborating every day to build the right software in small slices, a set of practices known as behavior-driven development, or BDD. Building on the work of BDD pioneers Dan North and Liz Keogh, we define BDD as

  • Exploring desired system behavior with examples in conversations

  • Formalizing examples into automated tests to guide development

Most resources for those who want to learn to practice BDD with Cucumber focus on the test automation part of BDD. Some of that emphasis is due to the fact that most of the tools associated with BDD—tools like Cucumber—help with the formalization and automation parts of BDD. That, after all, is where you need software tools the most.

In our coaching, however, we’ve noticed that teams need the most help with the collaboration part of BDD, the part where the least help is available. Once teams learn how to explore changes in system behavior with examples in a series of conversations and to capture those examples in expressive language, automating those examples turns out to be relatively easy.

This book shares what we’ve seen work best for the collaboration side of BDD. We show how the collaboration flows into automation—you’ll learn enough to get started automating your examples with Cucumber—but we haven’t written a cookbook for automating tests with Cucumber. This is a BDD book that uses Cucumber rather than a Cucumber book that mentions BDD.

This emphasis is consistent with the Agile values. The first value statement in the Manifesto for Agile Software Development says, “We value individuals and interactions over processes and tools.”1 We first determine who needs to be involved and how they need to work together, and then we consider what processes and tools would support and amplify those interactions. Starting with a process or a tool easily leads to suboptimal results. So, before focusing on Cucumber, a tool, it makes sense for us to explore and understand the interactions Cucumber is designed to support.

BDD uses examples rather than abstract specifications to explore the future behavior of a system. In the same way, we’re going to use examples to illustrate the BDD way of collaborating rather than just talking about it in theory. Throughout the book, we observe as the software development team for a (fictitious) large public library gets started with BDD. This will make it easier to see how BDD can help your team and to anticipate what it might look like for your team to adopt this way of working together.

The best way to understand the BDD way of collaborating, of course, is to experience it yourself. Beginning in Chapter 2, “Exploring with Examples,” we suggest an approach to slowly and safely begin experimenting with BDD on your team. But first, we need to lay the foundation to get started.

In this chapter, our library team—and you—learn how to start a new initiative with a meaningful increment of value, which is an essential prerequisite for BDD.

When Scrum Isn’t Enough

Many teams go through the mechanics of something like Scrum but don’t actually have potentially shippable product increments at the end of each sprint, let alone during the sprint. They simply lay sprints and Scrum meetings over their work as they’ve always done it.

Most teams who adopt an Agile approach to their work do so because they want to get progress, feedback, and value earlier and more often. A process framework like Scrum provides a good structure for this—planning and reviewing work in short cycles, frequently inspecting and adapting the process, and working from a prioritized backlog are all essential. But for most teams, there are some missing skills that keep them from getting the results they want. Our aim is to teach you these skills. Throughout this book, we’ll see what it looks like for Mark and his team to learn this new way of working and how you can apply it to your own work.

Mark’s team has been using Scrum like many organizations do at first: They commit to big projects, with detailed scope in a requirements document, just like they did before Scrum. They convert these requirements into a product backlog, per Scrum, but early sprints don’t really deliver potentially shippable product increments. Instead, early sprints are heavy on architecture, infrastructure, design, and planning, with limited value for users.

Of course, all this back-end work needs testing. But until developers finally start exposing the back-end code via user-facing functionality, testers struggle to test it. Testers find themselves underused in early sprints and overwhelmed in later sprints.

The experience is similar for business stakeholders and users. Early in a project, there isn’t much to see and to provide feedback on. Later, there’s an overwhelming amount of stuff to look at and too little time to look at it.

Eventually, on every project it becomes clear that the team isn’t going to hit the deadline for the required scope, so they either move the date or look for places to cut features or alter the overall scope. Unfortunately, many features that could be cut are already partially implemented, and some of the most essential features might not have been implemented yet at all.

Susan is right to be concerned that the ebook project would use up the whole budget without delivering something markedly better than the off-the-shelf alternative. Working the same way tends to produce the same results.

Some Scrum teams learn how to write user stories to capture small, but complete, slices of functionality. However, unless product owners, developers, and testers fundamentally change how they collaborate with each other, they still end up with a mini-waterfall in each sprint, as shown in Figure 1-1.

A figure illustrates Mini-waterfall in a sprint.

Figure 1-1 Mini-waterfall in a sprint

The first step in breaking out of mini- (or full-scale) waterfalls is to find a meaningful, but small, increment of value to begin with. Then, BDD can help teams grow a system example by example, planning, building, and testing every day.

Finding a High-Value Feature to Start With

Before You Start with Cucumber

Recall from our definition at the start of this chapter that BDD is about using concrete examples to develop the right software. To come up with good examples and to build features example by example, getting feedback along the way, the work must be organized in slices that deliver value. If you don’t have good functional slices—if you’re building components or doing technical tasks—you’ll end up with scenarios that look more like developer-facing unit tests than like examples of valuable system behavior from a user’s perspective.

Finding the First MMF

An MMF is a good place to start. MMF stands for minimum marketable feature.2 It’s a small slice (minimum) of new functionality (feature) with enough of an impact to be worth getting in front of real users (marketable).

This is analogous to the concept of a minimum effective dose (MED) in medicine. Consider, for example, acetaminophen, a common drug for pain relief. Taking 5 mg has no effect. For a typical adult, 650 mg can make pain go away for a few hours. But as little as 7500 mg can cause acute liver failure. More isn’t better—it’s worse. We want to use as little of a drug as we can to achieve the desired impact because drugs have side effects. This amount is the minimum effective dose. Likewise, developing too much of a feature has side effects: delays, missed market windows, opportunity costs, waste, and so on. We want to build the minimum amount of feature to have the desired business impact and no more.

To get at the first MMF or two from a big idea, we recommend a technique we call feature mining:

  1. Get a few people in the same room (or virtual equivalent) to represent both the business and the technical perspectives for this project.

  2. Together, brainstorm answers on a whiteboard or set of flip charts to these four questions:

    1. Where’s the value or impact? (Why is this worth doing? What benefits will go to whom?)

    2. What makes it big? (Why do we need to slice it at all? What is there many or much of? What always takes a long time, even if it’s well understood?)

    3. Where are the risks? (What irreversible negative consequences could happen?) Write these as statements of the risk being realized (for example, “We’re not able to optimize the performance enough for the reports to run overnight,” not just, “Performance”).

    4. Where are uncertainties? (What important questions do we need to answer for this to succeed?)

  3. When you get more than one or two answers to a question, identify the most important answers to each question, as shown in Figure 1-2. With a larger group, you might need to use a technique like dot voting to get a quick answer. To dot vote, give each participant three dot stickers per list. They can apply their dots all on one item in the list, or they can spread the dots across two or three items.

    A figure illustrates Identifying the most important answer to each feature mining question.

    Figure 1-2 Identifying the most important answer to each feature mining question

  4. Brainstorm possible ways to slice the big idea that get you a good piece of the value, perhaps some risk mitigation and learning, but without all the things that make the project big. We like to ask the following while pointing at the corresponding most important answers in each column:

    “How can we get some of this top impact without taking on all this ‘bigness’? What if we just…”

    “How can we mitigate this risk without taking on all this ‘bigness’? What if we just…”

    “How can we answer this question without taking on all this ‘bigness’? What if we just…”

  5. Identify an MFF to start with. It’s often the intersection of more than one of your possible ways to slice.

Once you have the first MMF or two, the next MMFs tend to follow pretty naturally. Occasionally, the first MMFs address a major risk or uncertainty, and after completing those, it’s necessary to do another round of feature mining with the new information you gained from building the first MMFs.

When we first started using this approach, we were afraid we’d run into projects where the value and what made the project big were inextricably linked. If we wanted to get the value early, we’d have to take on the hard parts first. Surprisingly, as we’ve done this over and over with different clients, we’ve found that the biggest contributor to value and the biggest contributor to size rarely intersect. There’s usually an 80/20 pattern where a relatively small effort contributes a disproportionately large slice of value. Then, there are diminishing returns as you have to start doing the hard parts to claw out the rest of the value. (Of course, you can always stop with the 80% and move on to the next 80/20 slice of something else.)

After a while, this process becomes more intuitive. Jonah was able to help Susan and Mark find a first MMF by prodding about value, effort, risk, and uncertainty without formally facilitating the meeting described earlier. But when you’re first getting started approaching projects in a new way, taking it step by step builds the skills and mindset you need to eventually do this more fluently.

Slicing an MMF into User Stories

Even if your first MMF is truly minimal, it’s almost certainly more than a few days of work. It might even be more than a sprint’s worth of work. As the Agile Manifesto says, “Working software is the primary measure of progress,”3 so it would be nice to have real, working slices of new functionality before getting to the end of the MMF. You could organize your work around architectural components and tasks— as many teams do—but these tend to mislead you about your progress and limit your ability to get quality feedback along the way. Instead, we recommend slicing an MMF into user stories.

What’s a User Story?

A user story is a description of a change in system behavior from the perspective of a user. Each story should add an increment of value, but you will likely have to accumulate a handful of stories before you have enough value to be worth shipping (hence the MMF). Nonetheless, because user stories are complete slices of new behavior, they give a better indicator of progress toward the MMF and a better increment for seeking feedback from stakeholders.

Stories often follow the format: “As a <role> I want <action/feature> so that <value/goal>.” Or, sometimes, stories will use an alternative format: “In order to <value/goal>, as a…” The format isn’t the important thing, though. What’s important is answering the questions raised by the template: Who wants this? What do they want? Why?

To that end, teams who use stories fluently rarely write a story in one of those formats. Instead, they’ll answer the three questions in different places. If a story is for the main role, which is described in a product vision, they’ll omit the role for that story. They’ll use a short, two- to four-word title at the top of the story card or in the story title field in a digital tool. And they’ll just write the “why” on the card or in the story description field. It looks something like that shown in Figure 1-3.

A figure illustrates an alternative to the usual user story format. The question “who” points the text that reads “Product vision FOR target customer WHO has some need”. The questions “what” and “why” points the text that reads “Short story title in order to ipsum dolor ait amet, consectetur adipiscing elit.”

Figure 1-3 An alternative to the usual user story format

So how do you get good user stories from an MMF? Just as you did with feature mining to slice a big idea into MMFs, you can ask the four questions about value, size, risk, and uncertainty. At the MMF level, though, you’ll often have enough of an understanding of value, risk, and uncertainty from doing feature mining that you won’t need to formally answer those questions. The interesting question here is, “What makes this particular MMF big?”

Patterns for Splitting Features and Big Stories

There are some common patterns for what makes features big and corresponding ways to split through that complexity to get good user stories. Let’s look at a few.4

Sometimes an MMF is big because it describes a workflow with multiple steps. If you can describe the user experience of your feature with at least three boxes and with arrows between them, as shown in Figure 1-4, you probably have one of these workflow features.

A figure shows a typical workflow diagram. Two boxes A and B with an arrow pointed from A to B is drawn. An arrow from B is pointed to a decision box. From the decision, two arrows are drawn pointing towards the boxes C and D, respectively.

Figure 1-4 A typical workflow diagram

In this case, look for a story that takes a thin slice through the whole workflow. For example, if you had a feature about finding and borrowing a book, you might split it so that the first story only offers the opportunity to borrow one hard-coded book, or you might allow patrons to find and borrow a book but not to accumulate multiple books in a cart and borrow them all at once. Then, write additional stories to account for the missing pieces to flesh out that workflow.

Sometimes an MMF is big because it includes multiple operations, where you’re allowing the user to manage some entity in the system. In this case, you could split the feature into a story for each of these operations. For example, “Manage my library account” easily splits into

  • Create my account

  • View my account details

  • Change my password

  • Change my account details

  • Cancel my account

  • Etc.

Other times the MMF is big because it includes many business rule variations, which we could split across multiple stories. In Chapter 6, “Making Scenarios More Expressive,” we look at an example of the library team working on the logic around fines for returning books late. There are many different business rules for fines based on whether you’ve borrowed a book or a DVD, for example, or whether you’re a child or an adult. These rules can be sliced into separate stories.

Sometimes, it’s not the variety of rules that makes a feature big but the variety of data that needs to be tested through those rules. For example, maybe the library catalog needs to support multiple languages. The rules are the same for each language, but working with the different languages may reveal edge cases and bugs, so each significant variation needs to be tested. You might choose to start with just one or two representative languages rather than supporting all of them from the beginning.

Occasionally, a complex user interface makes a feature big. In that case, we can often slice the feature to use a simple interface first and enhance it with the full-featured interface later. This is particularly useful when the value or learning is mostly associated with the behavior rather than the interface, and the interface just adds incremental value.

Often a feature has a simple core, a “happy path,” with many variations and enhancements. That simple core can be its own story, and then the variations can be grouped into several more stories. This approach helps you focus on what really matters in a feature. You might not even end up building some of the variations.

Choosing a Story to Start With

So, you’ve split your MMF into a handful of user stories; which one do you start with? Does it even matter? An MMF, by definition, will be released as a single unit. We’ve defined anything less than the MMF as less than marketable. So, we don’t worry much about prioritizing by value within an MMF. Instead, we prefer to prioritize by learning and risk mitigation. We’ll look for a story that will teach us something about the problem or solution. Often, this is the story that will get us the most feedback from a key stakeholder to confirm that we’re solving the right problem or solving it in a useful way. We can safely leave the least risky or least informative stories for last.

If you’ve used feature mining to find your MMF, you probably already listed the questions you need to answer and risks you need to mitigate. These lists can help you prioritize the stories.

Keeping It Minimal

As you split an MMF, you’ll think of new variations you weren’t aware of at the beginning. Remember the first M of MMF, minimum. Each story should earn its way into the MMF. Ask yourself questions like, “Is this story essential to this MMF or is it something we could come back to later?” You don’t want nice-to-have stories holding essential stories hostage.

Summary

  • BDD is exploring desired system behavior with examples in conversations and formalizing examples into automated tests to guide development.

  • BDD is primarily a way of collaborating, not primarily a test automation approach.

  • Approaches like Scrum are good, but insufficient, because teams often do miniwaterfalls within or across sprints. BDD can help teams avoid mini-waterfalls.

  • A prerequisite to BDD is work organized into slices of value. We recommend minimum marketable features (MMFs) and user stories for this.

  • Feature mining can help you find your first MMF from a big idea.

  • You can split MMFs into user stories using patterns like thin slices through a workflow, stories for business role variations, stories for different operations, and stories for data variations.

  • Start with the story that will teach you something or mitigate a key risk.

  • Keep your MMFs minimal by making each story earn its way into the MMF.

  • Once you have at least one good MMF with at least one good user story (and a cross-functional team to work on it), you’re ready to proceed with BDD.

Reference

Denne, Mark, and Jane Cleland-Huang. Software by Numbers: Low-Risk, High-Return Development. Santa Clara, CA: Sun Microsystems, Inc., 2004.

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

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