Scenario-Based Modeling

As we explained in the previous chapter, the pictographic language gets by without symbols for conditionals, variations, or alternatives. With Domain Storytelling, you model just the most important alternatives—each one as an individual domain story. As Cyrille Martraire put it in Living Documentation , “One diagram, one story” [ Martraire 2019 ]. If you are used to flowcharts , BPMN , or UML activity diagrams , a diagram that shows just one possible path might seems awkward at first. However, a UML sequence diagram does exactly it—shows a single path of execution. Actually, scenario-based modeling has a long tradition in software development. Use cases , for example, are also scenario-based.

What Are Scenarios?

John Carroll describes scenarios as follows [ Carroll 2000 ]:

  • Scenarios are stories about people and their activities.

  • Scenarios take place in a fixed context.

  • Scenarios contain actors that typically have goals.

  • Scenarios have a plot. They consist of a sequence of activities and events.

Domain stories are scenarios in that sense. We use the terms story and scenario interchangeably in this book. They are concrete, meaningful examples of a business process (see Figure 3.1 ).

Images

Figure 3.1 A scenario is one instance of a business process

Exploring a Domain with Scenarios

Think about traveling through Europe 1 as an analogy: Europe is the domain that you want to explore. If you take the route we have marked on the map in Figure 3.2 , from Lisbon to Helsinki, you will cover a lot of countries and landscapes (the subdomains) and cross many borders. Still, you will completely miss many countries, the entire Alps, the Mediterranean Sea, and much more. To get a sound understanding of Europe’s boundaries, you will need to make several comprehensive journeys—or, in other words, model several scenarios.

Images

Figure 3.2 A journey through Europe as an example of a scenario. Picture taken from OpenStreetMap.org

Scenarios in Domain Storytelling

When we model a business process, every possible instance of that process could be described in the form of a scenario or domain story. But what do we do if several important alternatives need to be covered? How do we narrow down the vast number of instances? We will take another look at the cinema example to illustrate our approach.

The movie theater Metropolis sells (a) tickets for single shows and (b) yearly subscriptions. This means app developer Anna cannot simply ask movie theater manager Matthew to tell her a story about a moviegoer who approaches the cashier. Instead, she asks him which case is more common, and he tells her that selling tickets for single shows makes up 75% of his revenue. Therefore, Anna asks Matthew to tell her about this case and writes down “ticket sales” on the whiteboard—the name for the domain story.

While she is recording the story, additional assumptions are made to avoid drifting off to different story lines. For example, they assume that enough seats are available, that the moviegoer likes the seats the cashier offers, and so on: “Assuming that there are still seats available, what do you do next?” Anna writes all these assumptions down as annotations.

Images

We recommend you start with modeling the default case—the “80% case”—and the “happy path” first.

That should give you a general idea of the purpose of the process. It will help you to understand why the actors are doing all this. Narrow the case down—no exceptions, no errors, the sun is shining, everything is fine. Later, you can ask what could go wrong, and you can model important variations and error cases as separate domain stories. For example, if shows in a cinema are sometimes overbooked, you definitely want to look into that case.

1 . We thank Jörn Koch for this analogy.

Usually, a few domain stories are sufficient to understand a business process. One or a handful of COARSE-GRAINED domain stories will help you to figure out where to dig deeper and what other resources you will need. Often, you only need to add a few FINE-GRAINED stories to start prototyping.

Small variations in a business process such as optional activities are simply not worth the effort of modeling them separately. Instead, you should use annotations.

At the Metropolis, Anna and Matthew model the variation of the previous assumption—the case “there are no more seats available”—as a domain story in its own right. This results in Metropolis 3 (see Figure 3.3 ).

Images

Figure 3.3 Metropolis 3: Ticket sales, show is sold out— FINE-GRAINED

If it helps participants to commit to one story line, you can make assumptions about the story as a whole and annotate the sentence where an assumption comes into play. For example, Metropolis 3 is about a case where there are no seats available (an assumption about the story as a whole). Additionally, the third sentence (“The cashier searches for available seats in the seating plan.”) is annotated with “Assumption: No seats available.”

As you can see, it started as a copy of the happy path Metropolis 2 (see Figure 1.10 ). The first three sentences are the same. In step 3, Anna adds an annotation that no seats are available. From there on, the story line differs. To make that visible, let’s place Metropolis 2 (see Figure 1.10 ) and 3 (see Figure 3.3 ) side by side in Figure 3.4 .

Images

Figure 3.4 The Domain Storytelling approach: modeling different cases in different stories: Metropolis 2 and 3

If large parts of two stories overlap, it may be better not to duplicate all the steps in the new story. Starting the story from the first step that differs is also a possibility. This is especially true if you are working with an analog modeling tool that makes copying a cumbersome task.

Of course, there is also value in “algorithmic” descriptions of business processes, and one cannot develop software without thinking about conditionals. But premature abstractions are often wrong and not useful for understanding a domain. Bad abstractions obscure the domain; good abstractions add precision to the domain language.

Images

First establish a sound understanding of typical cases—tell stories. Only then discuss what else could happen—collect rules.

A method that may help with finding such rules is Example Mapping (see Chapter 7 , “ Relationship to Other Modeling Methods ,” for more details).

Concrete Examples as Scenarios

In some domains, it can be difficult to identify scenarios like “typical case” and “happy path.” In such situations, we recommend a different approach. Try to model several past cases with increasing complexity: a simple case, a moderately difficult case, and a difficult case.

Once, when we were developing software for an emergency task force at a port, we naïvely asked the domain experts for common cases and happy paths. They shrugged and said, “We deal exclusively with the unexpected and with exceptions to the rules.” So we asked them to give us three examples for emergencies they’d had to deal with in the last year, from simple to complex:

  • A loose container drifting in the harbor

  • A blackout that affects the rail system during a heavy storm; a train is stuck in an area that is at risk of being flooded

  • A freighter stranded and in danger of bursting, potentially polluting the harbor

For every scenario, they told us a rich domain story with increasing complexity.

Keeping an Overview

To avoid modeling an overwhelming number of scenarios, it is important to restrict yourself to modeling only the most important variations of a business process.

Images

Aim for a representative sample, not for completeness!

When you need to model several complex businesses and each has several important variations, you will end up with dozens of domain stories. It is useful to organize them in a way that helps you keep an overview. Here are some strategies that have worked for us:

  • As you have already seen, a COARSE-GRAINED domain story like Metropolis 1 (see Figure 1.9 ) can serve as an anchor for more detailed domain stories (like Metropolis 2, shown in Figure 1.10 , and Metropolis 3, shown in Figure 3.3 ).

  • Many companies use wikis to organize and document knowledge. A wiki makes it easy to build hierarchical structures and navigate within them using hyperlinks. Domain stories can also be organized with a wiki. Take photographs from drawn diagrams or use the files created directly with a digital tool. 2

    2 . We would not necessarily model a use case diagram in real life if there were just a handful of domain stories and two actors.

  • If many different actors are involved, it can be useful to check at a glance who is involved in which scenarios. UML’s use case diagrams can provide such an overview [ Rumbaugh et al. 2005 ]. In a use case diagram, you can put together all the actors who play a role in your domain stories. Figure 3.5 shows an example for the Metropolis cinema. 3 It contains two use cases, represented as ellipses—“ticket sales” and “subscription sales.” Both use cases involve a cashier and a moviegoer, represented as stick figures. The “ticket sales” use case was covered with two scenarios (“happy path” and “show is sold out”). Hence, the ellipse contains not only the name of the use case, but also the name of the domain stories in which the scenarios were modeled (Metropolis 2 and 3). That way, the two types of diagrams are linked, and the use case diagram provides an overview that tells you which actors are involved in which domain stories.

Images

Figure 3.5 Use case diagram for Metropolis

Now you know how to get an overview of FINE-GRAINED domain stories. Let’s look more closely at that granularity and other properties of domain stories.