InterviewKata
Design patterns track · 25 patterns, one app

Learn every design pattern by building one real app.

All 23 classic patterns plus dependency injection and repositories, each solving a real problem in Pedal, a city bike-share: docks that release different vehicles, payment providers with clashing APIs, bikes that change state, promo rules written by marketing. Every page shows the pain first, draws the pattern, runs the code in Python, TypeScript and Java, and says when not to use it.

Start here → The pattern map Which pattern solves what
The whole track is liveAll 26 pages are ready, with every program tested in three languages.

Why a separate track

The Low-level design track's patterns module is a short tour of the handful that come up in almost every interview. This track gives every pattern its own page: the problem it solves, a drawing of its roles, the change it makes cheaper, runnable code, a lab, and the simpler option to reach for first. Pedal is the same app the Architecture styles track builds, so here you see it up close, one class at a time.

The pattern map

Which pattern solves what

Start from the problem in front of you. Read across a row for one pattern; the last column names the pattern people most often mix it up with.

PatternUse it whenIn PedalOften confused with
Factory methodWhich class to create depends on who is creatingEach kind of dock releases its own vehicleSimple factory, abstract factory
Abstract factoryObjects must come as a matching setEach city's lock, terminal and displayFactory method
BuilderAn object has many optional partsA ride receipt with optional linesConstructor with ten arguments
PrototypeCopying a configured object is easier than building itNew fare plans start as copiesBuilder
SingletonExactly one shared instanceThe pricing configA global variable; dependency injection
AdapterAn interface doesn't match the one you needTwo payment providers, one interfaceFacade, decorator
DecoratorAdd behaviour around an object without editing itLogging and retries around faresProxy, inheritance
FacadeA subsystem is too busy for its callersOne startRental() callAdapter, mediator
ProxyAccess to an object needs controlA remote dock, a cached availability countDecorator
CompositeSingle items and groups should look the sameCity, zones and stations count free bikesDecorator
BridgeTwo things vary independentlyAlert kinds × delivery channelsStrategy, adapter
FlyweightToo many objects repeat the same data40,000 bikes share a few model recordsCache, singleton
StrategyOne step has interchangeable algorithmsMember, pay-as-you-go and student pricingState, template method
StateBehaviour depends on a changing stateDocked, in use, faulty, in repairStrategy
Template methodFixed steps, some filled in by subclassesEach city's monthly reportStrategy, factory method
CommandRequests must be queued, logged or undoneOperator actions on docksStrategy, memento
Chain of responsibilitySeveral handlers may deal with a requestUnlock checks in orderDecorator, pipes and filters
ObserverOthers must react without the source knowing themA return notifies billing and the mapMediator, event bus
MediatorMany objects talk to each other in a tangleA station controller for its docksObserver, facade
IteratorWalk a collection without knowing its storageA member's trips, page by pageA plain loop over a list
VisitorNew operations over a fixed set of classesExport the fleet two waysPattern matching
MementoUndo without exposing an object's insidesA route plan being editedCommand
InterpreterRules written in a small languagePromo rules from marketingA parser library
Dependency injectionObjects find their own dependenciesReal payments in production, fakes in testsSingleton, service locator
Repository and unit of workDomain code is tangled with storageRides and payments saved togetherDAO, active record

The 4-week roadmap

About 40 minutes a day. Before each page, read its first section and sketch your own fix for ten minutes, then compare.

WeekStudyOutput by Friday

Where to go next

Start here →

What a pattern is, Pedal, and how to read a pattern page.

Low-level design →

Put the patterns to work on full interview problems.

Architecture styles →

The same app, built at the scale of whole systems.