Coding Labs
Twenty-two production-style backend components to implement yourself, in Java and in Go. Each one comes with a written contract, a diagram, a starter stub, a test suite that checks the contract, and a reference solution to compare against afterwards.
01
What is in a lab
Small components of the kind a backend actually runs on: a blocking queue, a rate limiter, an outbox, a route planner. Each is scoped to be built in a sitting and still have edges worth getting wrong.
A contract
The task, the API, the rules and a worked example, written down before any code. Every lab page also has implementation steps and a checklist.
A diagram
Every lab has one, showing the structure or the timeline the contract talks about.
Starters in Java and Go
IntelliJ IDEA projects with the public API in place and every method body left as a TODO: Gradle on JDK 21, and a Go module run with
-race.Tests that check the contract
They fail out of the box. A supplied suite finds the boundary you skipped, the tie you broke differently, the interleaving you never imagined.
A reference solution
For both languages, with the full test suite, to read only after your own version passes.
02
Four steps per lab
The order matters more than the code.
Read the contract and the tests.
List the inputs, outputs, boundaries, invariants, failure behaviour and limits before writing anything.
Implement the starter.
Replace every TODO. Run the lab's tests and fix what fails before reading anything else.
Compare.
Open the reference solution and explain one difference in representation or synchronization.
Change something.
Add a test for an edge case you chose, or implement the variation the lab page suggests.
03
The 22 labs
Six groups. New here? Start with L05 Bounded TTL Cache: its tests show the shape the others expect, with an injected clock, an inclusive deadline and a concurrent schedule.
-
Concurrency building blocks
Hand-offs, pools and coalescing between threads.
-
Caches and admission control
What to keep, what to evict, and who gets in.
-
Time, scheduling and capacity
Deadlines, bookings and windows over an injected clock.
-
Reliability and data integrity
Retries, idempotency and the transactional outbox.
-
Graphs and hierarchies
Dependencies, trees and shortest paths.
-
Geospatial
Objects that move, zones they cross, and the roads under them.
Pick one and make the tests pass.
Every lab page has the task, the diagram, the API, the rules, a worked example and a checklist.