Skip to content

Build a Table Book for a Small Bistro

Davor Minchorov•Beginner•1 to 2 weekends•November 5, 2026

A ten-table bistro keeps its bookings in a paper notebook, forgets that a party stays for 90 minutes, and puts two parties on the same table. You will build the booking book that gives each party the smallest table that fits, refuses a booking that clashes and says why, and keeps cancelled and no-show bookings on record.

The brief

The client

I own a bistro in Amsterdam with ten tables and thirty-six seats, and I take every booking myself on the phone, into a paper notebook. I am the host, the person who answers the phone and seats the guests. A party that books for 19:30 sits for about an hour and a half, which I call a sitting, and I forget that when someone rings for 20:30 and the same table looks free on the page.

Last Saturday two parties turned up for table 4, and a party of six was written onto a table for two because it was the only empty line. I do not need an app for guests, only one place where I type a name, a phone number, how many people and when, and it tells me which table they get or why they cannot have one.

The problem

The notebook shows a table as free whenever its line on the page is empty, so a table that is still occupied looks available. Each clash leaves a party turned away at the door or seated late, and the host decides by memory which table fits which party. The host also cannot see at a glance which tables are free at 20:00 when a walk-in appears, a party that arrives with no booking and asks for a table.

A no-show, a party that booked and never arrived, keeps its line in the notebook, so the host cannot tell whether to hold that table or give it away. A cancelled booking is crossed out and forgotten, so a guest who cancels every other week looks the same as a guest who never booked.

The client's name and figures are invented for this brief; the rules and the failures are ones that real businesses of this kind work with.

The spec

Requirements

  • Keep a list of the bistro's tables with the number of seats each has.
  • Let the host see and change the bistro's day: the opening time, the last time a sitting may start, and the sitting length in minutes. A change shows everywhere at once.
  • Take a booking for a guest name, a phone number, a party size, a day and a time, and give the party the smallest free table that fits it.
  • Never hold one table for two bookings at overlapping times, and never put a party on a table with too few seats.
  • Refuse a booking with a reason the host can read, and save nothing. The reasons are: the party size is not 1 or more, the time has already passed, the time is before opening, the time is after the last seating, no table is big enough, and every big-enough table is held at that time.
  • Cancel a booking so its table is free again, and mark a no-show so the host can seat a walk-in at that table. Both stay on record.
  • Show one day's bookings in time order with their table and state, and answer which tables are free at a time for a party of a given size.
  • Let the person or the request supply the current time for a booking, so the refusal for a time that has passed can be tried without waiting. This exists for testing.

Deliverables

  • A running program with your own choice of interface: a web page, an API that other programs call by sending requests, or a command-line tool. It keeps its data when it is closed and started again.
  • A README that takes a reviewer from an empty book to a finished Saturday in 10 minutes, with the steps to take a booking, cancel one, mark a no-show and read the day's list.
  • A document with the bistro's tables and hours and at least 10 example bookings, each with the table the owner expects or the reason for the refusal.
  • A table of at least 8 pairs of times with the expected answer for each, worked out by hand before any program decides overlaps.
  • An automated test set, code that drives the book and checks its answers against what you expect, that replays a full Saturday with one command and compares the result with a list worked out by hand beforehand.

Out of scope

  • Accounts and logins. The bistro has one book and one host. Do not put this tool on the internet, because anyone who can reach it can read every guest's phone number and cancel any booking.
  • A booking page for guests, reminders by text message or email, and guest accounts. The host types every booking, and the rule matters more than the screens.
  • Two hosts booking the last free table at the same moment. Your program handles one booking at a time here. The intermediate project, Build a Till and Stockroom for a Tapas Bar, deals with several sellers drawing on the same limited count.
  • A waiting list that offers a cancelled table to the next party. It is a second rule on top of the first.
  • Deposits, card guarantees and no-show fees. They need a payment provider, and this project holds no money.
  • Joining two tables for a large party. It changes the rule from one table to a set of tables.
  • Orders, the menu, the kitchen and stock. The book ends when the party is seated.
  • Staff rotas, several sites and reports on guests served. Each is a project of its own.
  • Different hours per weekday and closed days. One daily schedule keeps the overlap rule visible.
  • Checking that a phone number is a real phone number. The host types what the guest says.

Architectural constraints

  • Every booking time is Amsterdam clock time (Europe/Amsterdam), and shows the same hour whatever the machine running the program is set to.
  • Every duration is a whole number of minutes.
  • Two bookings on one table overlap when each starts before the other ends. A booking that starts exactly when another ends does not overlap it.
  • Only a booking that is still booked holds a table. Cancelled and no-show bookings stay on record and hold nothing.
  • When two tables both fit a party, the one with fewer seats is taken, and if still tied, the lower table number.
  • A change to the sitting length, the opening time or the last seating never changes a booking already taken.
  • A refusal for a time that has passed can be tried without waiting: the person or the request can supply the current time, for testing.
  • Saved data survives closing and restarting the program.

Prerequisites

You can write a small program in a language of your choice and have saved data to a database or a file once. You do not need to know how a booking system works or any particular framework. You do not need to know how a small bistro seats its guests; the first Phase explains the business and the words the brief uses. Having written one automated test helps.

Create a free accountSign in

Free to start. An account is what keeps track of the checkpoints you finish.

Phase 1

Describe the bistro and store its tables

Produces a written description of the bistro's evening with example bookings, the ten tables and three settings saved, and bookings saved and read back. Leaves every booking rule for later, so this book still accepts two parties on one table.

Research

Implementation

Implementation

Architectural walkthrough

How a small bistro seats its guests

A bistro in Amsterdam has ten tables and thirty-six seats. The owner is also the host, the person who answers the phone and seats the guests. Guests book by phone with a name, a phone number, how many people are coming and a time, and the host writes it in a notebook.

A party that books for 19:30 occupies its table for about an hour and a half, which the host calls a sitting. A table that looks free at 20:30 may be occupied by the earlier party until then. The host picks a table that fits the party. Some guests arrive with no booking, and some who booked never arrive.

The words this brief uses:

  • Host: the person who takes bookings and seats the guests.

  • Party: the group of guests under one booking, with a size.

  • Sitting: how long a party holds its table, about an hour and a half.

  • Last seating: the latest time a sitting may start.

  • Walk-in: a party that arrives with no booking and asks for a table.

  • No-show: a party that booked and never arrived.

  • Table: a place with a fixed number of seats.

Why the first decisions are cheap to change

This Phase has almost no rules. You decide what the program knows about the bistro and what a saved booking holds. Both decisions are cheap to change today and awkward once the rules lean on them.

The failure this Phase must survive is a change of mind by the owner. Suppose the owner changes the sitting from 90 minutes to 120. Every booking already in the book now ends half an hour later than the guest was promised, and two parties who were safely apart on Tuesday overlap on Wednesday without anyone having booked anything. A booking has to keep the end time it was given when it was taken.

You also write down ten example bookings with the answers you expect, before any rule exists. The Phase ends with a book that saves a clash on purpose, and you note that gap in the README. A later Phase closes it, and the examples you wrote here are the first thing it has to agree with.

Phase 2

Take bookings by the rule

Produces bookings that are accepted onto the smallest free table that fits, or refused with a reason. Leaves cancelling, no-shows and the day's list for later.

Research

Implementation

Implementation

Implementation

Testing

Architectural walkthrough

This Phase turns the saved bookings of Phase 1 into a book that decides. The failure it must survive is a book that disagrees with itself: the list of free tables shows table 6, the booking is then refused for table 6, and nobody can say which one is wrong. The host sees both answers and trusts neither.

The first Checkpoint is a table of time pairs with answers you work out by hand. You write them before any program decides, so the table cannot copy a mistake from the program. The pairs include the awkward ones: back to back, one minute of overlap, and the same start. A rule that handles the middle of the evening and fails at its edges looks fine until a full Saturday.

The clock causes a second failure: the refusal for a time that has already passed depends on what time it is now.

From here on, any example that involves the refusal for a passed time sets its own current time. The real date moves on after you write this, and an example that depends on today stops being true.

Phase 3

Run the evening

Produces cancelling, no-shows, the day's list and a replay of a full Saturday that proves the whole book. Leaves guests, money and several hosts out.

Implementation

Implementation

Testing

Architectural walkthrough

The book now takes bookings. This Phase handles what happens to a booking after it is made. The failure it must survive is a table that stays held when it should be free, and the opposite: a guest's history that disappears when the table frees.

The last Checkpoint replays a whole Saturday against a current time you set, so the result is the same on every run and any later change that breaks a rule shows up as a line that differs.

Architectural walkthrough

The book answers for every booking before it

Whether table 5 is free at 20:30 depends on every booking already made for that night, on how long each one sits, on how many people each party has, and on whether any of them was cancelled. A book that only records what the host typed knows none of that. This project turns on one rule: a booking holds its table for a whole sitting, no table is held by two bookings at overlapping times, and a party is never put on a table with too few seats.

A booking at a different minute can still clash

Take Ana, booked on table 5 for 19:30. Her sitting runs until 21:00. A second party rings for 20:30 and asks for table 5. The two start times differ, and if the book accepts it, two parties stand at one table. That is the notebook's bug.

A party who asks for table 5 at 18:30 is a different case. Their start is before Ana's, yet their sitting runs until 20:00 and collides with hers. A book that looks only at start times gets the first case wrong. A book that only asks whether the new start lands inside an existing sitting gets the second case wrong.

The end of a sitting leaves the table free

Ana's sitting ends at 21:00, so a party booked at 21:00 on the same table is the normal case, not a clash. A book that treats 21:00 as still taken turns that party away, and the bistro loses a table on the night it is full.

The same evening on any machine

A start of 19:30 means nothing until it says where. If the book follows the clock of the machine running it, a host on a server in another country sees a different hour, and a party is told to arrive an hour early or late. Phase 1 saves bookings so that 19:30 reads as 19:30 in Amsterdam from the first booking on.

A promise made stays made

The owner decides that a sitting is 120 minutes and not 90. Every booking already in the book must keep the end time its guest was promised. If they all end half an hour later, two parties who were safely apart on Tuesday overlap on Wednesday, and nobody booked anything in between.

The smallest table that fits

A book that gives the first free table it finds gives a party of 2 a six-seater, and the party of six who rings later finds none. The host then turns away a booking the bistro could have taken. The same bookings must also give the same tables on every run, which is what lets you write one expected answer per example.

Cancelled stays on record

Erasing a cancelled booking frees the table, and it also erases that the guest ever booked. The host can then no longer tell a guest who cancels every other week from one who never booked. A cancelled or no-show booking frees its table and stays in the day's list, with its state in plain words.

Where it shows if you cut a corner

A 20:30 booking accepted on a table held until 21:00 means the book ignores how long a sitting lasts. A party of 2 on a six-seater while a two-seater is free means the book takes whatever table it finds first. A 21:00 booking refused after a 19:30 one ended at 21:00 means the book counts the end of a sitting as taken. A table that never frees after a cancel means the book still counts the cancelled booking. The Saturday replay in the last Checkpoint exposes all four, because its final list was worked out by hand before the program ran.