
Elevate your Python object oriented programming by mastering built in language features in classes, exploring concepts like inheritance, polymorphism, structural subtyping with static type checking to improve debugging and design.
Explore how Python uses classes and objects to model data such as name and salary, instantiate employees, and access attributes with the dot syntax, while UML class diagrams describe structure.
Learn how methods bind to a class instance and interact with object state through self. Implement get full name, raise salary, and add bonus; update UML diagrams.
Explore how Python builds object representations with __str__ and __repr__, learn when and how to implement them for debugging, and distinguish informal vs. unambiguous representations.
Explore how Python allocates memory and initializes objects via dunder new and dunder init, and how they form the class constructor, store arguments in data attributes, and govern instantiation order.
Explore python inheritance, including single inheritance, subclassing, and overriding getinfo to achieve polymorphism while avoiding duplicate code; learn when to abstract a base class to prevent instantiation.
Learn how abstract base classes in Python prevent instantiation and enforce method implementation using the abc module, illustrated with shape, render, and getinfo.
Extend base class initialization with super in a shape hierarchy and in employee and manager examples, demonstrating overriding and reusing behavior under single inheritance.
Explore how OOP fits into a dynamically typed language like Python, where types are inferred and checked at runtime, with static type checkers offering compile-time checks.
See how type hints and static type checking catch errors like multiplying strings, using Mypy and Pyrite to annotate functions and variables in Python.
Explore why Python does not support method overloading, compare with statically typed languages, and learn alternatives such as optional parameters, keyword arguments, and alternative constructors; preview polymorphism.
Explore how polymorphism in Python eliminates type switches by using a common render method across shapes, upholding the open-closed principle while combining inheritance and polymorphism for robust code.
Explore how Python achieves polymorphism through duck typing and special methods like __str__ and __len__, and learn to enforce interfaces with type hints and protocol classes.
Explore how typed abstract base classes are enforced with mypy, turning abstract methods like render into guaranteed interfaces for subclasses, catching type mismatches and embracing dynamic return types.
Discover how protocols enable structural subtyping and static duck typing without inheritance, split interfaces into logical protocols, and verify correctness with static type checkers.
Examine encapsulation in Python by using a single underscore and name mangling to signal privacy, while noting Python cannot truly make attributes private.
Explore how Python uses properties to simplify encapsulation by turning accessor methods into attributes, with examples of salary and thermostat, including read-only properties and decorators.
In Python, a class is an object that can instantiate instances, define class variables to share data, and support class and static methods, demonstrated with dunder string and type objects.
Explore how class methods provide alternative constructors using cls to instantiate without an object. Learn static methods host circle utilities, like radians to degrees, without class data, enabling namespaced grouping.
Explore how Python binds methods to objects without using classes, by building objects as dictionaries, simulating a class with helper functions, and using partial binding to supply self.
Apply the open-closed principle by replacing type switches with polymorphic employee methods, enabling new employee types without modifying reporting code in Python.
Explore how Python uses classes and objects to master inheritance, polymorphism, and encapsulation, finishing with practical guidance on next learning steps.
Explore how special methods weave Python's object model into your classes, enabling language features like iteration and subscription context managers, and expanding your advanced object-oriented programming toolkit.
This course teaches Object Oriented Design in Python beyond intermediate level. The course solidifies and deepens your knowledge about classes, objects, inheritance and polymorphism. You will learn many Python specific class and object implementation details of construction, overriding and overloading. Work through many exercises that allows you to practice common OOP tasks.
Target audience
Developers who especially benefit from this course, are:
Python developers who learned the basics of OOP and want a deeper dive into the mechanics of OOP in Python
developers who bring experience from another OO programming language and want to learn how to use OOP in Python
self-taught OOP developers who want to improve their skills by learning best practices
Challenges
Students that are interested in this course often know basic OOP features but are not yet aware of Python’s unique language features that allows them to work object oriented in a Pythonic way. This can lead to verbose or inefficient code. It is my goal to teach you up-to-date, preferred ways to work with OOP in Python and make your code structured and maintainable.
What can you do after this course?
make better decisions when and how to use OOP features in your code
create more efficient classes by integrating Python’s built-in language features
embrace the dynamic character of Python by using structural type checking
Topics
Classes and Objects: Class instantiation, self, data attributes, UML, methods, __str__, __repr__, constructor
Inheritance: Inherit, extend and override methods, access to base class via super, abstract base class
OOP in a dynamic language: Dynamically typing, Static type checking, overloading
Polymorphism: Open-closed principle, type equality, interfaces and protocols
Encapsulation: Attribute visibility. name mangling, properties
Classes in Python: Class as object, class variables, class and static methods
Duration
2 hours video time, 3 hours including practicing exercises.
The teacher
This course is taught by Loek van den Ouweland, a senior software engineer with 25 years of professional experience. Loek is the creator of Wunderlist for windows, Microsoft To-do and Mahjong for Windows and loves to teach software engineering.