C++ Low-Level Design
Learn to turn a vague request into a C++ design you can explain, test, and change: which questions to ask, which classes to write and which not to, who owns each object, and how to tell whether the design still holds when the requirements move.
Welcome back
One request, start to finish
Section titled “One request, start to finish”Every lesson on this site serves one skill: moving from a one-line request to a design you can justify. Here is that path in miniature, taken from the parking lot case study.
-
The request. “Design a parking lot.” One line, deliberately vague.
-
Ask the questions that change the design. “If the prices change while a car is parked, which price applies?” “The price shown at entry.” That single answer decides more of the design than any other.
-
Write it down, numbered. FR-4: each ticket keeps the fee rule in force at entry. AC-4.2: tickets issued before a price change keep their rule. Now the design has something to be checked against.
-
Decide what is not a class. A vehicle is an enum: nothing about it varies except which spots it fits. No
Vehiclehierarchy, noFloororGateclass, no Singleton. -
Give every member an owner. Each ticket holds
std::shared_ptr<const FeeRule> rule_: shared with the car park, kept alive after a price change, and read-only: it points to aconstrule whose functions are allconst. -
Test it by requirement. A test named
ac_4_1_and_ac_4_2_a_new_rule_applies_only_to_later_entries, and the code broken on purpose, eleven times, to check that the tests notice. -
Change it. Electric-vehicle chargers arrive. Spots gain a charger and tickets gain a charging price; the fee rules, payment, and exit do not change.
Choose a starting point
Section titled “Choose a starting point”The learning roadmap describes three paths in detail. Pick the one closest to you; you can switch at any time.
What the site covers
Section titled “What the site covers”Sections in reading order. Each card shows how many lessons are published so far and their difficulty; the site is written section by section, and a section marked “planned” has no lessons yet.
Orientation
What low-level design is, the five-step delivery framework, how to read the examples, and a reading path for your background.
C++ foundations
The C++ that design depends on: object lifetime, explicit ownership, RAII, smart pointers, interfaces, and value semantics.
Modeling
Finding classes, data members, and member functions; invariants, relationships, and lifecycles; outlines, traces, and state diagrams.
Requirements
Turning a vague request into clarifying questions, assumptions, use cases, acceptance criteria, and a traceable list.
Design principles
Cohesion, coupling, SOLID, DRY, KISS, and YAGNI, each with what it costs when it is pushed too far.
Design patterns
The classic patterns in modern C++: the problem first, the pattern second, and when a plain function or value type is better.
Architecture
From classes to components: layers, ports and adapters, composition roots, repositories, and choosing among them.
Advanced design
Ownership graphs, thread safety, deadlocks, exception safety, idempotency, performance, and stable API boundaries.
Testing and evolution
Testing strategy, test doubles and seams, and changing a design safely, in small steps, as requirements move.
Practice
Quizzes, guided design walkthroughs, and a design-readiness checklist.
Case studies
Complete designs, from a one-line request to tested C++, with the changes that follow and how to present them in an interview.
How the lessons are written
Section titled “How the lessons are written”- The problem before the pattern. A pattern appears only after the simpler design has been shown and its limits are clear, with the costs and the cases where it does not fit.
- Code you can trust, or code that says it is a sketch. Every C++ block is labelled. Code taken from the examples is compiled with GCC and Clang with warnings as errors, and its tests run, including under sanitizers; fragments are marked illustrative, and mistakes shown on purpose are marked flawed. See the about page for what each label means.
- Diagrams with words. Every diagram has a written equivalent, so nothing depends on seeing it.
- Exercises with answers. Most lessons end with an exercise; the answer stays hidden until you open it.
Reader tools
Section titled “Reader tools”- Search is in the header; the glossary defines every term marked in a lesson.
- “Mark as read” and “Bookmark” buttons sit at the top of each lesson; My progress collects them. They are stored only in this browser.
- The sidebars can be resized or collapsed, and the page text adjusts to the space.