References#
Lecture 7
ENPM605 – L7: Object-Oriented Programming II
Covers class methods (@classmethod, factory methods), static
methods (@staticmethod), object relationships (association,
aggregation, composition), inheritance (super(),
generalization, specialization, MRO, isinstance(),
issubclass()), polymorphism, duck typing, operator
overloading, abstract base classes (ABC,
@abstractmethod), data classes (@dataclass, field(),
__post_init__, frozen=True), __slots__, and
typing.Protocol.
Python Language References
Python Tutorial
Official tutorial covering classes, inheritance, MRO, and Python’s object model.
Built-in Functions
Documentation for the @classmethod and @staticmethod
decorators.
Standard Library – abc
The abc module for defining abstract base classes and
abstract methods.
Standard Library – dataclasses
Full reference for @dataclass, field(),
__post_init__, and frozen=True.
Standard Library – typing
Documentation for Protocol and structural subtyping.
Python Data Model
Reference for __slots__, its memory implications, and
behavior in inheritance hierarchies.
UML and Design Resources
PlantUML
Syntax reference for class diagrams including association, aggregation, composition, and inheritance notation.
Mermaid
JavaScript-based diagramming tool with Markdown integration for class and relationship diagrams.
External Tutorials
Real Python
In-depth guide to inheritance and composition with practical examples and trade-off analysis.
Real Python
Detailed walkthrough of super(), the MRO, and
cooperative multiple inheritance.
Real Python
Guide to defining interfaces in Python using ABCs and Protocols.
Real Python
Comprehensive guide to @dataclass, field(),
__post_init__, frozen instances, and comparison with
named tuples and regular classes.
Real Python
Side-by-side comparison of the three method types with practical use cases.
Real Python
Deep dive into __slots__, memory profiling, and
inheritance considerations.
Real Python
Guide to typing.Protocol, structural subtyping, and
@runtime_checkable.
Python Glossary
Official definition of duck typing and its role in Python’s object model.
Style and Best Practices
Coding Conventions
Guidelines for class naming, method organization, and inheritance patterns.
Google Style Guide
Style conventions used in this course for docstrings and code organization.
Recommended Reading
Fluent Python (2nd Edition)
Chapters 11-14 cover the Python data model, special methods, interfaces, protocols, and ABCs. Chapters 22-24 cover dynamic attributes and descriptors. Essential reading for a deep understanding of Python’s object model.
Learning Python (5th Edition)
Chapters 29-32 cover advanced OOP topics: class design, advanced inheritance, operator overloading, and class decorators.
Effective Python (2nd Edition)
Items 37-44 cover classes and inheritance, including
super(), @classmethod, @staticmethod,
@property, descriptors, and metaclasses.
Design Patterns (Gang of Four)
The foundational reference for object-oriented design patterns. Factory Method, Composite, and Strategy are directly relevant to the patterns introduced in this lecture.