Skip to main content
Mental Models

Design Pattern

A design pattern is an established way to solve a recurring design problem. Looking for patterns in architecture, software, or everyday work can save time and reveal options you might otherwise miss. The useful question is whether the pattern fits the problem and its constraints.

THE IDEA

Design Patterns and Ways to Solve a Problem

A good plan of attack ensures that you are using the right tools and processes to get the job done. For instance, in writing this book, our first step was to develop an outline. Rather than write without direction or move back and forth between disparate concepts, we wanted to make sure the book flowed properly. An outline helped us link related concepts and group them into coherent sections and chapters.

When starting something new, a good thing to remind yourself is that there is no need to reinvent the wheel. It is unlikely that you are the first person in the world who has faced this task, and, with the ubiquity of self-published experts, you are likely to be able to find a website, blog article, or how-to video on almost any topic. As Benjamin Franklin wrote in The Way to Wealth, “An investment in knowledge pays the best interest.”

In many fields, leaders have agreed on best practices based on what has worked or what has not worked in the past. Architect Christopher Alexander introduced the concept of a design pattern, which is a reusable solution to a design problem. This idea has been adapted to other fields and is especially popular in computer science.

You are probably very familiar with common design patterns for everyday items. Think of doorknobs being set at a certain height so they are easy for most people to use, or staircases being wide enough for most people to walk on. They are the same because they adhere to the same basic design patterns that have proven to be useful. In some cases, the patterns have been made official standards, as in building codes.

There are likely design patterns applicable to whatever you are doing as well. For writing books like this, there are many design patterns, from the way the book is laid out and printed to the length and writing style expected. The same is true in our careers: design patterns for startups (how they are commonly financed, managed, etc.), coding (how code is structured, common algorithms, etc.), and biostatistics (common drug trial designs, statistical methods, etc.).

The opposite of the well-tested design pattern is the anti-pattern, a seemingly intuitive but actually ineffective “solution” to a common problem that often already has a known, better solution. Learning to recognize both patterns and anti-patterns can help you avoid common mistakes. Examples of anti-patterns include bike-shedding, present bias, and negative returns. You can avoid anti-patterns by explicitly looking for them and then seeking out established design patterns instead.

While some amount of planning is always useful, sometimes the most efficient way to finish a task is to dive in quickly and start, rather than getting bogged down in analysis paralysis (the analysis-paralysis problem discussed in Chapter 2 of the source book).

As a child, Lauren had a four-digit combination lock and she forgot the code to open it. Although one solution for an adult would be to just get a new lock, as a child she didn’t have the funds, and after a quick calculation, she decided it would be easy enough to open the lock by doing an exhaustive search for the combination. And, lo and behold, it worked!

Exhaustive searches like this are a type of brute force solution. The term brute force is obviously applicable when referring to an activity that requires literal force, such as chopping down a tree with an ax. However, it is also used to refer to any solution that doesn’t require an intellectually sophisticated method. For example, if you have to address ten envelopes, it can be faster to handwrite them than to print them.

Brute force solutions can be effective for many small-scale problems. However, they can quickly become untenable as the problem gets bigger, such as if you have a hundred envelopes to address. When this happens, using more sophisticated tools is an expedient though more expensive approach.

Consider again chopping down a tree. For a small tree, an ax or handsaw is okay. For a larger tree, you would want a chainsaw. For clearing a stand of trees, a “feller-buncher” is the preferred tool. In these cases, if you can afford it, it is effective to throw more money at the problem by spending on better tools.

However, some problems, such as large computational ones, can become intractable even with the help of sophisticated tools. For a password that is exactly eight characters long (letters or numbers, case sensitive), there are 218 trillion possible combinations—impossible to try by hand, and even extremely time-consuming for a computer. At 1,000 passwords a second, it would still take you 6,923 years to work through all those combinations.

A better method than trying every combination at random might be first to try combinations of words from the dictionary, recognizing that people often choose words for passwords. An even better method would consider common passwords, and words or numbers significant to this particular person, such as related birth dates, sports teams, or initials. This is a type of heuristic solution, a trial-and-error solution that is not guaranteed to yield optimal or perfect results, but in many cases is nevertheless very effective.

You should consider heuristics because they can be a shortcut to a solution for the problem in front of you, even if they may not work as well in other situations. If the problem persists, however, and you keep adding more heuristic rules, this type of solution can become unwieldy. That’s what has happened to Facebook with content moderation. The company started out with a simple set of heuristic rules (e.g., no nudity), and gradually added more and more rules (e.g., nudity in certain circumstances, such as breastfeeding, is okay), until as of April 2018 it had amassed twenty-seven pages of heuristics.

Both exhaustive searches and heuristics can be implemented as algorithms: step-by-step processes. Algorithms are pervasive in modern life, solving many otherwise intractable problems, but we often don’t even realize it. Consider travel: algorithms govern how traffic patterns are managed, how directions get calculated, how “best available” seats are selected, which hotels are recommended when you search for them . . . and that’s just a start.

Algorithms can range from the simple (like a traffic light that changes every two minutes) to the complex (like a traffic light that changes dynamically based on live sensors) to the highly complex (like an artificial intelligence that manages traffic lights across a whole city at once). Many algorithms operate as black boxes, which means they require very little understanding by the user of how they work. You don’t care how you got the best seats, you just want the best seats! You can think of each algorithm as a box where inputs go in and outputs come out, but outside it is painted black so you can’t tell what is going on inside. Common examples of black box algorithms include recommendation systems on Netflix or Amazon, matching on online dating sites, and content moderation on social media.

Physical tools can also be black boxes. Two sayings, “The skill is built into the tool” and “The craftsmanship is the workbench itself,” suggest that the more sophisticated tools get, the fewer skills are required to operate them. Repairing or programming them is another story, though!

When you think about using tools to get your work done faster, you should start by discovering all the off-the-shelf options available to you. These are effectively design patterns you can purchase. For example, when printing address labels, you can use mail-merge programs, preprinted sheets of labels, and full-service copy centers.

You will want to invest some time in figuring out the pros and cons of your various options, because you can easily get yourself into trouble (in wasted money or time, or worse) if you select the wrong tool. Experts can help you identify your options, like when you go to a home improvement store and ask for tool advice on a DIY repair. Once a tool is selected, you will also want to invest additional time in understanding how to use it effectively, or hire an expert to operate it for you.

As you face the same problem again and again, not only do you want better tools and algorithms, but you also want better processes for interacting with those tools and algorithms. For example, if you want to produce a personal budget, you might start with pen, paper, and a calculator. After you figure out your expenses in the first month, you might quickly graduate to using a spreadsheet because it can do calculations faster and with fewer mistakes.

Further still, you could find another program to move the data into the spreadsheet automatically, which will save you even more time each month. Automation like this makes sense when the eventual time and money saved through more efficient processing and possibly better results outweigh the costs of setting it up.

Automation is also a great way to take advantage of economies of scale, when an operation becomes more efficient as its size increases. Economies of scale explain some of the advantages larger companies have relative to smaller ones. They can afford to pay the large up-front costs to have the biggest factories and warehouses with the most cutting-edge robots and machinery. Once set up, this technology means each new product moves through the factory and warehouse faster and cheaper.

The companies can then spread the initial fixed costs across a large volume of production, being able to produce or ship goods at much cheaper rates overall, even accounting for the up-front costs. This overall efficiency means they can charge less than competitors. Think Amazon.

Another way to speed things up is parallel processing, in which you solve a group of problems in parallel. In a computing context, you’d literally assign different calculations to different processors, such that multiple calculations are done simultaneously, as opposed to in serial, where calculations are done one after another. The book uses Amazon’s network of more than a hundred warehouses as an example: daily shipping work can be divided among different facilities.

Parallel processing is an example of a divide and conquer strategy. If you can break a problem into independent pieces and hand these pieces out to different parties to solve, you can accomplish more, faster. Think of when you delegate parts of a project to different people or departments to work on.

Another strategy to get to a solution quicker when faced with a hard situation is to reframe the problem. Consider a central problem faced by Disney World: long lines. Most rides have limited seating, so the only way to move more people through the ride in the same amount of time is to build more apparatuses for the same ride. That’s expensive, involves closing the ride for a substantial period, and may not even be realistically possible given space constraints. But what if the problem was reframed not as “How do we move people through the line faster?” but “How do we make people happier while they wait in line?”

When a problem is reframed, the solution space really opens up, and you can see that Disney has employed a variety of solutions to this reframed problem. In the period described, Disney’s FastPass system allowed guests to avoid much of the wait for a limited number of rides. The posted wait times outside the line take away the mystery behind the wait time, one of the most frustrating characteristics of other queuing systems. The lines also have features like games, artwork, animatronics, etc., to entertain guests so that the wait does not seem as long. Some of these features seem like they should be incorporated in any queuing system as design patterns. Once frequent Disney vacationers (like us!) experience them, it can be frustrating to visit amusement parks without them.

In math and science, problems are often reframed or manipulated into forms that are easier to solve. This is done by taking advantage of already known algorithms and design patterns, transforming the problem into one with a readily usable solution.

As passwords have become harder to crack, hackers have reframed their problem of “How can we best guess your password?” to “How can we best get your password?” From this angle, a better solution, unfortunately, is social engineering, where you are manipulated to give up your password willingly. Hackers literally engineer a social situation designed to get you to give up your password. Think of phishing emails pretending to be from your accounts but which actually originate from hackers. These social-engineering techniques have been behind most high-profile targeted hacks, including celebrities’ iCloud photo accounts (2014), the release of emails from the Democratic National Committee and Hillary Clinton’s campaign chair John Podesta (2016), and a breach at the U.S. Department of Justice exposing the names, phone numbers, and email addresses of thousands of FBI and Department of Homeland Security employees (2016).

From brute force to reframing, these approaches offer different ways to tackle a problem. When you have a hard problem in front of you, take a moment to consider whether one or more of these models are applicable. A remark attributed to an anonymous woodsman is, “Give me six hours to chop down a tree and I will spend the first four sharpening the axe.”

KEY TAKEAWAYS

  • Choose activities to work on based on their relevance to your north star.

  • Focus your time on just one of these truly important activities at a time (no multitasking!), making it the top idea on your mind.

  • Select between options based on opportunity cost models.

  • Use the Pareto principle to find the 80/20 in any activity and increase your leverage at every turn.

  • Recognize when you’ve hit diminishing returns and avoid negative returns.

  • Use commitment and the default effect to avoid present bias, and periodic evaluations to avoid loss aversion and the sunk-cost fallacy.

  • Look for shortcuts via existing design patterns, tools, or clever algorithms. Consider whether you can reframe the problem.

When to use it

  • Choosing a software structure suited to expected changes, using established patterns where their tradeoffs fit the project.

  • Designing a user interface for a website by following standard patterns like navigation placement and form layout.

  • Streamlining a business process by adopting proven workflows from industry best practices.

  • Teaching a complex topic by using established pedagogical patterns like scaffolding and spaced repetition.

FROM THEORY TO EVERYDAY LIFE

In practice

01

Doorknob Height as a Design Pattern

A common doorknob height, such as about 36 inches, illustrates how a familiar arrangement can make a door easier to use. The appropriate height and hardware still depend on the users and the setting; one dimension does not make every door accessible.

02

Book Writing Outline

An outline is a familiar pattern for organizing a book: group related ideas, decide their order, and use that structure to guide the draft. It can reduce disorganization, though the outline may need to change as the writing develops.

✳

A MOMENT TO REFLECT

Put it to work.

  1. What common problem do you face repeatedly that might have a known design pattern to address it?

  2. How can you identify and adopt design patterns used by experts in your field to improve efficiency?

  3. When has an intuitive solution turned out to be an anti-pattern? How could you have recognized it earlier?

Connected ideas

Another lens can bring the same problem into focus.

Often confused with

References

  1. The Way to Wealth — Benjamin Franklin (1758)
  2. A Pattern Language — Christopher Alexander (1977)

CONTINUE THE CONVERSATION

Source texts

  • Super Thinking (Gabriel Weinberg, Lauren McCann)
← More mental models