Foundation
Object-Oriented Java
Objects as a design tool, not a syntax.
Classes, interfaces, inheritance and polymorphism — taught through the decisions they exist to make: what to expose, what to seal, when to compose, and what an interface is a promise of.
9 lessons written2 modules~2h reading
After this course you can
- Design a class whose invariants cannot be broken from outside
- Choose composition over inheritance and know the two cases where inheritance is right
- Use interfaces, default methods, records and sealed types for what each is for
- Explain dynamic dispatch, static binding and the cost of virtual calls
Curriculum
9 lessons · outlined lessons show their plan01
Classes, constructors and invariantsA constructor's real job is to make an object that is never wrong. Validation, final fields, the default constructor that disappears, JavaBeans, and the builder that arrives when there are too many parameters.13 minImmutabilityWhy immutable objects are simpler, cheaper to share across threads, and safe as map keys — and how to build one that is actually immutable.10 minStatic and instanceWhat static really means, when a static factory beats a constructor, and the singleton that is almost always a mistake.11 minNested and inner classesStatic nested, inner, local and anonymous — what each captures, what it costs, and why a non-static inner class can hold a whole object graph alive.12 minClasses and objects
02
Inheritance and polymorphismDynamic dispatch, overriding rules, upcasting and downcasting, super, the types of inheritance Java allows, abstract classes, and the fragile base class problem that makes inheritance a liability.15 minThe Object classWhat every class inherits: toString and what belongs in it, getClass versus the declared type, clone and why a copy constructor wins, and finalize, replaced by try-with-resources and Cleaner.12 minInterfaces and default methodsAn interface is a contract. Default and static methods, functional interfaces, and the diamond rule that resolves conflicts.10 minComposition over inheritanceDelegation, the strategy you did not know you were writing, and how to refactor a class hierarchy into objects that collaborate.10 minRecords and sealed classesData as data, hierarchies the compiler can check exhaustively, and pattern matching that turns a visitor into a switch.11 min