Affiliate disclosure

Book titles on this page link to Amazon. As an Amazon Associate, DataField.Dev earns from qualifying purchases — at no additional cost to you.

Further Reading: Inheritance and Polymorphism

Object-Oriented Design

  • Martin, R. C. (2017). Clean Architecture: A Craftsman's Guide to Software Structure and Design. Prentice Hall. (Tier 1) Covers SOLID principles including the Liskov Substitution Principle and the Open-Closed Principle in depth. More advanced than what we covered, but the chapter on dependency inversion connects directly to our discussion of programming to interfaces.

  • Gamma, E., Helm, R., Johnson, R., & Vlissides, J. (1994). Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley. (Tier 1) The classic "Gang of Four" book. Its examples are in C++ and Smalltalk, but the patterns themselves are language-independent. The Template Method pattern (Section 15.3's ReportFormatter) comes directly from this book. Best used as a reference rather than read cover-to-cover.

  • Slatkin, B. (2019). Effective Python: 90 Specific Ways to Write Better Python, 2nd Edition. Addison-Wesley. (Tier 1) Items 37-43 cover inheritance, mixins, super(), and composition in Python specifically. More practical and Python-focused than the Gang of Four book. Highly recommended for understanding when and how to use these features in real Python code.

Python-Specific OOP

  • Python Documentation: abc module. (Tier 1) https://docs.python.org/3/library/abc.html The official documentation for abstract base classes. Covers ABC, ABCMeta, @abstractmethod, and registration. Essential reference when designing class hierarchies.

  • Python Documentation: Method Resolution Order (MRO). (Tier 1) https://docs.python.org/3/howto/mro.html Michele Simionato's essay "The Python 2.3 Method Resolution Order," now hosted in the official docs. The definitive explanation of Python's C3 linearization algorithm (the name refers to the Python version that introduced C3, which modern Python still uses). Technical but thorough. Worth reading if you use multiple inheritance.

  • Ramalho, L. (2022). Fluent Python, 2nd Edition. O'Reilly. (Tier 1) Chapter 13 ("Interfaces, Protocols, and ABCs") and Chapter 14 ("Inheritance: For Better or for Worse") cover these topics in Python with extraordinary depth. The discussion of "Waterfowl and ABCs" (using collections.abc) is particularly relevant to understanding how Python's standard library uses the patterns from this chapter.

The Composition vs. Inheritance Debate

  • Composition Instead of Inheritance — Wiki.c2.com. (Tier 2) https://wiki.c2.com/?CompositionInsteadOfInheritance A page on the original wiki (Ward Cunningham's WikiWikiWeb), where experienced developers argue the guideline back and forth, starting from an "is-a" versus "has-a" example. Good for understanding the why behind the guideline, and for seeing that the experts don't all agree.

  • Scalfani, C. (2016). "Goodbye, Object Oriented Programming." Medium. (Tier 2) https://cscalfani.medium.com/goodbye-object-oriented-programming-a59cda4c0e53 A widely-read essay arguing that traditional OOP inheritance creates more problems than it solves. Provocative, but it raises valid points about the diamond problem and the "banana, gorilla, jungle" problem (Joe Armstrong's quip that you wanted a banana but got a gorilla holding the banana, and the entire jungle). Good counterpoint to the textbook treatment.

For the Curious

  • Python's collections.abc module. (Tier 1) https://docs.python.org/3/library/collections.abc.html A masterclass in abstract base class design. Defines abstract interfaces like Iterable, Sequence, Mapping, and MutableMapping. Study how they use @abstractmethod and mixin methods — it's the same pattern from Section 15.6 applied at scale.

  • Liskov, B. & Wing, J. (1994). "A Behavioral Notion of Subtyping." ACM Transactions on Programming Languages and Systems, 16(6). (Tier 1) Liskov first described the idea in a 1987 conference keynote, "Data Abstraction and Hierarchy"; this paper gives the principle its formal definition. Highly technical, but the introduction is accessible and gives you a sense of the formal reasoning behind the intuitive rule from Section 15.9.

  • Hettinger, R. "Super considered super!" (PyCon 2015 talk). (Tier 2) https://pycon-archive.python.org/2015/schedule/presentation/419/ Raymond Hettinger's talk explaining Python's super() in detail, including cooperative multiple inheritance. The video is on YouTube. Entertaining and clarifies many of the subtleties around super() that this chapter introduced.