Skip to content

Course

Python OOP & Design Patterns

Object-oriented Python that earns its keep — dataclasses, protocols, ABCs, composition, and the design patterns that still matter in a duck-typed language.

9 lessons

Course Q&A

Reviews

Enrolled members can rate this course.

No reviews yet.

Modeling With Objects

Dataclasses, value objects, invariants, and Python's object model — where OO actually helps.

  1. 01Dataclasses That Earn Their KeepDataclasses are not structs with extra syntax — used well, they are the cheapest correct way to model data with defaults, ordering, immutability, and validation.20mOpen
  2. 02Value Objects and InvariantsThe difference between data that merely exists and objects that cannot be wrong: invariants, factories, immutability, and total construction.22mOpen
  3. 03Python's Object Model: Dunder ProtocolsHow len, iteration, context managers, equality, and attribute access really work — and how to implement just enough of the object model without creating a puzzle box.24mOpen

Contracts and Boundaries

ABCs, protocols, composition, and the interfaces that keep teams decoupled.

  1. 01ABCs: Contracts With TeethAbstract base classes are for small contracts, shared implementation, and fast failure — not for recreating Java taxonomy diagrams in Python.21mOpen
  2. 02Protocols: Structural Typing for Real PythonProtocols let type checkers verify duck typing: what objects must provide, how runtime_checkable changes the game, and why narrower interfaces beat heroic abstractions.23mOpen
  3. 03Composition Over Inheritance, Without DogmaWhen inheritance is honest specialization, when it is implementation theft, and how composition plus dependency injection produces code you can test and replace.24mOpen

Patterns That Survive Python

Creational, behavioral, and structural patterns translated into idiomatic Python — and the ones to skip.

  1. 01Creational Patterns: Factories, Builders, and Dependency InjectionPython already has first-class functions and modules, so creational patterns shrink: factory functions beat factory hierarchies, builders are rare, and dependency injection is mostly constructor honesty.22mOpen
  2. 02Behavioral Patterns: Strategy, Command, Observer, IteratorBehavioral patterns map cleanly onto Python's functions, generators, events, and context managers — use the mechanism the language already gives you before building class ceremony.24mOpen
  3. 03Structural Patterns: Adapter, Decorator, Facade — and Pattern TriageThe structural patterns that matter in Python, how decorators differ from the Decorator pattern, and a field guide for deciding whether a pattern clarifies or merely decorates your résumé.25mOpen