January 2015
Intermediate to advanced
212 pages
4h 22m
English
Whenever we want to add extra functionality to an object, we have a number of different options. We can:
Composition should generally be preferred over inheritance, because inheritance makes code reuse harder, it's static, and applies to an entire class and all instances of it [GOF95, page 31], [j.mp/decopat].
Design patterns offer us a fourth option that supports extending the functionality of an object dynamically (in runtime): Decorators. A Decorator pattern can add responsibilities to an object dynamically, and in a transparent manner (without affecting other objects) ...
Read now
Unlock full access