Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Decorator pattern
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Overview== The ''decorator''<ref name="GoF">{{cite book|author=Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides|title=Design Patterns: Elements of Reusable Object-Oriented Software|year=1994|publisher=Addison Wesley|isbn=0-201-63361-2|pages=[https://archive.org/details/designpatternsel00gamm/page/175 175ff]|url=https://archive.org/details/designpatternsel00gamm/page/175}}</ref> design pattern is one of the twenty-three well-known ''[[Design Patterns|design patterns]]''; these describe how to solve recurring design problems and design flexible and reusable object-oriented software—that is, objects which are easier to implement, change, test, and reuse. The decorator pattern provides a flexible alternative to subclassing for extending functionality. When using subclassing, different subclasses extend a class in different ways. However, an extension is bound to the class at compile-time and can't be changed at run-time. The decorator pattern allows responsibilities to be added (and removed from) an object dynamically at run-time. It is achieved by defining <code>Decorator</code> objects that * implement the interface of the extended (decorated) object (<code>Component</code>) transparently by forwarding all requests to it. * perform additional functionality before or after forwarding a request. This allows working with different <code>Decorator</code> objects to extend the functionality of an object dynamically at run-time.<ref name=":0">{{cite web |title=The Decorator design pattern - Problem, Solution, and Applicability |url=http://w3sdesign.com/?gr=s04&ugr=proble |archive-url=https://web.archive.org/web/20230408204922/http://w3sdesign.com/?gr=s04&ugr=proble#gf |archive-date=2023-04-08 |access-date=2017-08-12 |website=w3sDesign}}</ref>
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Decorator pattern
(section)
Add topic