6.4 Abstract Base Classes (ABCs) in Python
When designing large functional units in Object-Oriented Programming (OOP), which involves inheritance, it is important to consider the use of Abstract Base Classes (ABCs). An ABC is a concept that involves defining a parent class to provide certain functionalities that all derived classes should implement. This approach ensures that the parent class itself cannot create meaningful objects.
Fortunately, in Python, the 'abc' module in the standard library provides the infrastructure for defining custom abstract base classes. This enhances the readability and robustness of code by allowing us to define a blueprint for other classes. By using ABCs, we can create a hierarchy of classes that share a common interface, thus making it easier to implement and maintain code.
In addition to providing a common interface, abstract base classes can also define common API for its derivatives. This means that it can force derived classes to implement...