Overview
Your complete guide to Objects and design
Five lessons that take you from the function to the class: the object and its state, inheritance and polymorphism, abstract contracts, then drawing your design in UML and applying the three best-known design patterns.
Each part opens with an animation, then what you need before you start, then the idea with code you run, then a step-by-step and a worked example. Read the parts in order, as each builds on the last.
Each part ends with myth vs reality, a multiple-choice question, cards that flip when tapped, and "check your understanding" questions with hidden answers. Use them before you say "got it".
Do not leave a part before its exercise tests pass. Reading alone proves nothing; the exercise does.
Pick a topic
A look at Objects and design
You start by making one object and understanding what it holds, build a family of classes through inheritance, then write a contract every child keeps. After that you draw what you built as a UML diagram before writing it, and finish with the patterns engineers talk in.
| Part | Topic | You learn |
|---|---|---|
| 1 | Classes & the Object Model | Class and object, __init__ and self, encapsulation |
| 2 | Inheritance & Polymorphism | Inheritance and super, overriding, polymorphism |
| 3 | Abstract Classes & Interfaces | ABC and abstractmethod, duck typing, mixins |
| 4 | UML Modeling | Class and sequence diagrams, the six relationships |
| 5 | Design Patterns in Python | Factory, Observer and Decorator |
Done with this lesson?
Sign in to save your progress.