Series
Java Design, Measured
1 episode, in order. The code builds on itself, so following from the start leaves you with a complete system rather than a pile of samples.
-
Java Object Relationships: Inheritance, Composition and Polymorphism →
One payment scenario, six relationships. A subclass that counts three payments as six, the obvious fix that breaks when the parent changes one line, the delegating version that does not, association, aggregation and composition told apart by three questions, and polymorphism by overriding against a sealed switch. Real Java code, the class diagram notation, and the output of every run.