Overview
This module introduces the topic of "design patterns" in object-oriented programming with a look at two such patterns, Inheritance and Composition, and how they can be implemented using Python classes.
Links
Learning Outcomes
After completing this module, students should be able to:
-
Use the inheritance pattern to share functionality among Python classes.
-
Use method overriding to extend Python classes.
-
Use the composition pattern to create classes that make up other classes.
-
Build interfaces that provide access to component objects from the containing object.
-
Understand the importance of careful consideration of use cases and reusability in designing software.
Additional Readings
-
The Chapter "Object-Oriented Programming" from the open-souce textbook, Object-Oriented Programming in Python (University of Cape Town, 2013-2014) provides a good overview of this module’s content.
-
For students interested in digging deeper into this topic the works of Martin Fowler are a good next step.