Skip to content

Worked Projects Across the Library

This index connects five worked builds in their subject books: a matching engine, a text-to-SQL agent, an idempotent event API, a k-means implementation, and an agent evaluation harness. Each was shipped under a deadline, then rewritten as standard-library Python that runs its own tests, and each records the order it was actually built in, because the build order is the lesson. The studies are for engineers who already know the underlying theory and want to see it applied under pressure, and for anyone preparing to defend design decisions in a live interview or a design review.

  • Sequence a build so a correct version exists early and each later layer is earned by a named bottleneck.
  • Find the one invariant that makes a system testable.
  • Justify each optimization with evidence, and say what it costs and where it does not help.
  • State plainly what you chose not to build, and why.
  • Break an implementation on purpose and predict which test catches it.

Each study takes about half a day of focused work, so all five take two to three days.

In every study, read the concepts, run the file with python <file>.py from the study’s directory, then break it deliberately and watch the tests catch you.

Each study names its own prerequisites. The order book draws on Programming and Algorithms. SQL agents, k-means, and agent evaluation draw on AI Engineering. The event API draws on Systems Engineering. Software Engineering supplies testing, authorization, and lessons from practice. How to read these books explains the shared method.

Most studies make the same move in different domains: build the obvious correct version, name its bottleneck, then earn each improvement.

StudyBaselineEarned improvementWhat the jump costs
Order bookFlat list, linear scanHeap of price levels, then a tick-indexed ladderMemory, and an assumption about price range
SQL agentOne tool, no groundingSchema discovery, bounded retry, deterministic gateTokens per query, and latency
Event APICheck-then-act dedupConstraint dedup, then atomic claimNothing; the correct version is also simpler
K-meansRandom init, fixed iterationsk-means++, then incremental updates and distance boundsNothing algorithmic; only code complexity
Eval harnessCompare final rowsReplay verification, then oracles and mutantsStorage per call, and a suite to maintain

Not every improvement is a trade-off: dedup by unique constraint is less code than checking first, and it is correct under concurrency.