September 2020
Intermediate to advanced
653 pages
10h 37m
English
This chapter covers the Decorator pattern.
Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality.
From the GoF definition, it is evident that this pattern uses an alternative to subclassing (i.e., inheritance). If inheritance is not allowed, how do you proceed? Yes, you guessed it right. It prescribes you to use composition instead of inheritance.
By following the SOLID principle, this pattern promotes the concept where your class is closed for modification but open for ...
Read now
Unlock full access