May 2022
Intermediate to advanced
678 pages
11h 48m
English
This chapter covers the Decorator pattern, which is also known as the Wrapper pattern.
It attaches additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality.
An alternative to inheritance is composition. It is quite common in programming and often gives you a better payoff. This chapter shows a useful case study on this topic using some wrappers.
So, what is a wrapper(or a decorator)? A wrapper is like a topping that surrounds ...