Checkpoint: Hostile-Reviewer Session
advanced20 min readLesson 124 of 180
Build a Session that survives constructor-time, accessor-time, and external mutation attacks.
Checkpoint: the object model under pressure
A Session object must survive three hostile reviewers: one mutates the list
it passed to the constructor, one mutates what your accessor returns, and one
constructs the object from a superclass constructor that calls an overridable
describe() method.
Build the class that survives all three — initialization-safe, alias-proof, and immutable-friendly.