Skip to Content.
Sympa Menu

gang-of-4-patterns - Re: [gang-of-4-patterns] Decorator

gang-of-4-patterns AT lists.cs.illinois.edu

Subject: Design Patterns discussion

List archive

Re: [gang-of-4-patterns] Decorator


Chronological Thread 
  • From: "Thomas Mercer-Hursh, Ph.D." <thomas AT cintegrity.com>
  • To: David Rosenstrauch <darose AT darose.net>
  • Cc: gang-of-4-patterns AT cs.uiuc.edu
  • Subject: Re: [gang-of-4-patterns] Decorator
  • Date: Thu, 25 Feb 2010 11:15:03 -0800
  • List-archive: <http://lists.cs.uiuc.edu/pipermail/gang-of-4-patterns>
  • List-id: Design Patterns discussion <gang-of-4-patterns.cs.uiuc.edu>
  • Organization: Computing Integrity, Inc.

David Rosenstrauch wrote:
Sorry for the late response.

Seems like one should be grateful for any response on this list these days...

Quintessential example of this would be, say, the InputStream and
OutputStream families of I/O objects in Java. You take any "vanilla"
stream object (e.g., that writes to a file, a socket, etc.) and then
add functionality onto it by wrapping it in decorator streams - e.g.,
BufferedOutputStream, PrintStream, etc.

I'm familiar with usage like this and have poked around at a number of sources. All of them that I find are consistent with this notion of dynamic addition of behavior to individual objects, i.e., places where Generalization and/or Delegation would not necessarily work well since those are static decompositions. What I was wondering about is whether there was any support for this fellow's approach of using this pattern as a routine substitute for what would normally be done by Generalization and/or Delegation.

FWIW, my write-up on the topic has been completed and can be found here:
http://www.cintegrity.com/content/%E2%80%9CGang-Four%E2%80%9D-Decorator-Pattern-What-Its-Appropriate-Use
I should probably note that my focus in general is on OO as it should be practiced in ABL, the Progress 4GL, so a bit different than the 3GL world, although I believe the same principles should be applied and this particular discussion seems to me to be independent of the implementation language.
--

======================================================================
Consulting in Architecture-Driven Modernization and Transformation
----------------------------------------------------------------------
Thomas Mercer-Hursh, Ph.D. email:
thomas AT cintegrity.com
Computing Integrity, Inc. voice: 510-233-5400
60 Belvedere Avenue fax: 510-233-5446
Point Richmond, CA 94801-4023 url: http://www.cintegrity.com
======================================================================






Archive powered by MHonArc 2.6.16.

Top of Page