Day 3 — Overview

Jun 10

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:

Locked learning resources

Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Already a member? Sign-In

Locked learning resources

The full lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Already a member? Sign-In

You must own this product to join the conversation.