---
title: "One chair and a double tap"
url: "https://www.mikefluff.com/en/experiments/nw-ch05-race"
locale: "en"
author: "Mikhail Savchenko (Mike Fluff)"
updated: "2026-11-24"
description: "Race condition and double submit, explained"
book: "https://www.mikefluff.com/en/books/nobody-writes-code"
alternates:
  - locale: "en"
    url: "https://www.mikefluff.com/en/experiments/nw-ch05-race"
    markdown: "https://www.mikefluff.com/en/experiments/nw-ch05-race.md"
  - locale: "ru"
    url: "https://www.mikefluff.com/ru/experiments/nw-ch05-race"
    markdown: "https://www.mikefluff.com/ru/experiments/nw-ch05-race.md"
  - locale: "pt"
    url: "https://www.mikefluff.com/pt/experiments/nw-ch05-race"
    markdown: "https://www.mikefluff.com/pt/experiments/nw-ch05-race.md"
  - locale: "es"
    url: "https://www.mikefluff.com/es/experiments/nw-ch05-race"
    markdown: "https://www.mikefluff.com/es/experiments/nw-ch05-race.md"
---

# One chair and a double tap

*Race condition and double submit, explained*

Two scenes from the chapter that no screen shows. In the first, two clients book the same stylist, Kristina, for Saturday at eleven. The program checks that the slot is free and then saves the booking. When both clicks arrive at the same instant, both checks see a free slot before either booking is saved, and both go through. This is called a race condition.

Choose “One after the other” or “At the same instant” and press “Both press Book”. One after the other, the second client is told the time is taken. That is how an administrator tests a site, alone, and so the race never happens. At the same instant, Kristina ends up with two clients and one chair. Turn on the rule in the database, one booking per time slot, and the database refuses the second booking whatever the code did. The booking code itself stays as it was.

The second tab is a payment on the metro. The connection is slow, the page is thinking, and the client taps “pay” again. Two requests go out and her card is charged 1,500 roubles twice. With a unique key on every payment, the payment service recognises the second request as a repeat and charges once, however many taps there were. The same thing happens when a program repeats a request on its own after getting no answer.

The steps run slowly so they can be followed; in life they take a fraction of a second. The chapter is about who asks the question. A model knows everything about race conditions and will not bring them up unless asked, so a beginner working with one gets code that passes every test they thought to run.

_The page has an interactive experiment that runs in a browser: https://www.mikefluff.com/en/experiments/nw-ch05-race_

## Sources

- [Race condition (Wikipedia)](https://en.wikipedia.org/wiki/Race_condition)

## From the book

Beside it in the book:

> The last story is very short. A button of the wrong colour is repainted in a minute, while data laid out according to the wrong schema takes weeks to rearrange, and not always without losses. This is why experienced engineers fear changes to the structure of data far more than changes to the interface, whereas beginners, on the contrary, argue for hours about the colour of buttons and agree without looking to whatever schema the model proposed.
>
> Dozens more such scenes could be written. All of them are things an experienced programmer knows from his own bruises and a beginner with an AI assistant does not know at all, because none of them is visible on the screen.

- Read the chapter: [Chapter 5. Why a Beginner with Claude Did Not Become a Senior](https://www.mikefluff.com/en/read/nobody-writes-code/ch05) (opening free, rest in the full book; Markdown: https://www.mikefluff.com/en/read/nobody-writes-code/ch05.md)

- Book: [Nobody Writes Code Anymore](https://www.mikefluff.com/en/books/nobody-writes-code) — $15
