The running program
The Registry
One program, built across the whole course. It starts as two variables in Phase II and ends up as something several threads can use at once. Every step below is a real exercise, and each one adds to the same program.
Most courses give you a new toy problem every chapter, and you throw each one away. The Registry is here so that you don't. When you meet inheritance in Phase VII, you're not modelling animals that make noises. You're giving the Registry you already wrote a family of unit types, and you can see exactly what it bought you.
Phase II. Data and Memory
- 2.1The Registry Begins
This exercise checks whether you can choose types on purpose instead of typing int everywhere.
- 2.2The Money Bug
This exercise checks whether you can recognise the situation where double is the wrong tool.
- 2.1The Registry Begins
Phase III. Logic and Flow
- 3.1Registry Flags in One int
This exercise checks whether you can use bitwise operators for what they are really for, which is packing many yes-or-no answers into one number.
- 3.2Registry Status Rules
This exercise checks whether you can turn a set of written rules into readable conditional code.
- 3.3Registry Roll Call
This exercise checks whether you can drive a loop from user input rather than a fixed count, and whether you pick the loop shape that fits.
- 3.1Registry Flags in One int
Phase IV. Data in Rows
- 4.1The Registry Gets a Roster
This exercise checks whether you can hold several parallel facts about many units using only arrays.
- 4.2Build a Growable Array Model
This exercise checks whether you can build the core strategy used by array-backed lists by separating size from capacity, allocate a larger backing array when full, and copy.
- 4.1The Registry Gets a Roster
Phase V. Methods
- 5.1The Registry Grows Methods
This exercise checks whether you can restructure a long main into named pieces, and whether you use overloading where it genuinely helps rather than everywhere you can.
- 5.1The Registry Grows Methods
Phase VI. Objects
- 6.1From Parallel Arrays to Objects
This exercise checks whether you can see what a class buys you, by rewriting code you already wrote badly.
- 6.2Chain Them Properly
This exercise checks whether you can put validation in exactly one place.
- 6.3Close Both Reference Leaks
This exercise checks whether you can identify a mutable reference crossing a class boundary and apply defensive copying on both input and output.
- 6.4A Registry That Counts Itself
This exercise checks whether you can choose class-level or per-instance ownership for each member and predict class initialization separately from object construction.
- 6.1From Parallel Arrays to Objects
Phase VII. The Four Pillars
- 7.1The Registry Gets a Family
This exercise checks whether you can design a small hierarchy where the shared parts genuinely belong in the parent.
- 7.3The NullPointerException With No Dot
This exercise checks whether you can recognise unboxing hiding in an innocent looking line.
- 7.1The Registry Gets a Family
Phase VIII. Identity and Contracts
- 8.1Load the Registry From a File
This exercise checks whether you can read structured data from a file, handle the bad rows, and close the file properly.
- 8.2An Immutable Registry
This exercise checks whether you can build a nested immutable structure, where a class holds other immutable objects.
- 8.3Registry Identity
This exercise checks whether you can decide what identity means for a real domain object rather than mechanically including every field.
- 8.4Enums Carry Data
This exercise checks whether you can move a rule out of scattered if statements and into the type it belongs to.
- 8.5A Registry Built on Interfaces
This exercise checks whether you can put the whole phase together.
- 8.1Load the Registry From a File
Phase IX. Text and Types
- 9.1Build Your Own Immutable Text
This exercise checks whether you can build the design String uses, including the pool.
- 9.2Registry Report Builder
This exercise checks whether you reach for a StringBuilder when building text in a loop.
- 9.4Pick the Right Signature
This exercise checks whether you can choose between T, ?
- 9.1Build Your Own Immutable Text
Phase X. The Collections Framework
- 10.1Registry, Rebuilt on Collections
This exercise checks whether you can replace hand-written array code with the framework and see what you deleted.
- 10.2Make Your Own Class Work With For-Each
This exercise checks whether you can implement Iterable.
- 10.4Choose For a Real Workload
This exercise checks whether you can pick an implementation from the shape of the work rather than from habit.
- 10.5Prevent Mutable Keys in the Registry Map
This exercise checks whether you can prevent HashMap lookup failures by designing immutable keys.
- 10.6TreeMap Answers Questions HashMap Cannot
This exercise checks whether you know what sorted order buys you.
- 10.8Order Registry Requests with a Comparator
This exercise checks whether you can order a queue by something other than arrival.
- 10.8Registry Reports, Sorted Every Way
This exercise checks whether you can decide what belongs as a natural order and what belongs as a comparator.
- 10.1Registry, Rebuilt on Collections
Phases XI to XIV don't have their steps yet. The Registry will get stream reports, loading that fails properly, a look at what it costs in memory, and finally two threads touching it at once.