Markus 5ce932ceb7 Work on #213
- properly categorize all patterns
- remove pattern list from readme
- minor fixes to readme
- removed "introduction" because its not a pattern and an error i
committed some time ago
2015-08-20 21:40:07 +02:00

21 lines
797 B
Markdown

---
layout: pattern
title: Decorator
folder: decorator
permalink: /patterns/decorator/
categories: Structural
tags: Java
---
**Intent:** Attach additional responsibilities to an object dynamically.
Decorators provide a flexible alternative to subclassing for extending
functionality.
![alt text](./etc/decorator_1.png "Decorator")
**Applicability:** Use Decorator
* to add responsibilities to individual objects dynamically and transparently, that is, without affecting other objects
* for responsibilities that can be withdrawn
* when extension by subclassing is impractical. Sometimes a large number of independent extensions are possible and would produce an explosion of subclasses to support every combination. Or a class definition may be hidden or otherwise unavailable for subclassing