Re: May I have a example of design pattern of "composite", I still feel fuzzy after reading book of Addison-Wesley's"design pattern "
- From: Logan Shaw <lshaw-usenet@xxxxxxxxxxxxx>
- Date: Fri, 31 Aug 2007 00:31:04 -0500
Alf P. Steinbach wrote:
* jones9413@xxxxxxxxx:Thank you for your kind & help !
See [http://en.wikipedia.org/wiki/Composite_pattern#Example], which I found in 1 second of googling (and so could you).
Yeah, but to be fair, from a quick reading, that Wikipedia page is a
terrible explanation. I'm sure they're trying to say something else,
but the way it reads, they seem to be implying all objects are shapes.
Or that the Composite pattern is always used with objects representing
shapes.
Also, under the "When to Use" section, their explanation could almost
just as easily be applied to explain the concept of inheritance. The
actual sentence I'm talking about is this:
You find that you are using multiple objects in the same way,
and often have nearly identical code to handle each of
them -- the only differences being that you are manipulating
an instance of a 'circle' versus a 'square', for instance.
Yeah, isn't that what inheritance is for -- when I have multiple
objects of different types that should have the same behavior? Once
again, I'm certain there really is something behind this explanation
and that they mean something else; it's just that it's not phrased
well enough to get across the intended meaning clearly.
- Logan
.
- Follow-Ups:
- Prev by Date: Re: Any progress yet? (was Re: Fast pi program?)
- Next by Date: Re: Any progress yet? (was Re: Fast pi program?)
- Previous by thread: How to make the playlist in embedded wmp plays from given time, not begging?
- Next by thread: Re: May I have a example of design pattern of "composite", I still feel fuzzy after reading book of Addison-Wesley's"design pattern "
- Index(es):
Relevant Pages
|