Decorators and clean code
Now that we know more about decorators, how to write them, and avoiding common issues, it's time to take them to the next level and see how we can leverage what we have learned to achieve better software.
We have briefly touched on this subject throughout the previous sections, but those were closer-to-the-code examples, as the suggestions referred to how to make specific lines (or sections) of the code more readable.
The topics discussed from now relate to more general design principles. Some of these ideas we have already visited in previous chapters, but the outlook here is to understand how we use decorators for such purposes.
Composition over inheritance
We have already discussed briefly that in general, it's better to have composition rather than inheritance because the latter carries some problems of making components of the code more coupled.
In the book Design Patterns: Elements of Reusable Object-Oriented Software...