...

/

Decorators and Clean Code

Decorators and Clean Code

Learn how decorators help achieve clean code in software design.

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've learned to achieve better software.

We briefly touched on this subject previously, 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 previously, 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 ...