Day 3: Object Creation, Inheritance & Composition
Wed, Jun 10 @ 19:30 UTC (2 hours)
Today the codebase grows up. You’ll learn classmethods as alternate constructors with clean named entry points for each way an object gets created. Then we’ll face the most consequential decision in OO design: when to reach for inheritance and when to reach for composition.
The cardinal mistake new OO developers make is using inheritance where composition would serve better. You’ll see it set up as a counter-example so it never happens in your own code.
You’ll also meet abstract base classes (ABC) and @abstractmethod, which is Python’s way of formalizing the contract a subclass must implement, so missing methods fail at construction time rather than somewhere downstream.
Today’s concepts:
