Talk:Combining design patterns
From CSSEMediaWiki
(Difference between revisions)
Douglas Wall (Talk | contribs) m (Question) |
|||
(3 intermediate revisions by 3 users not shown) | |||
Line 5: | Line 5: | ||
Does [[Composite]] + [[Strategy]] = [[Decorator]]? --[[User:Douglas Wall|Douglas]] 03:23, 5 August 2009 (UTC) | Does [[Composite]] + [[Strategy]] = [[Decorator]]? --[[User:Douglas Wall|Douglas]] 03:23, 5 August 2009 (UTC) | ||
+ | |||
+ | :I think that a decorator often uses a composite pattern like structure for aggregation, but I don't really see how strategy is related... --[[User:Matthew Harward|Matthew Harward]] 14:59, 5 August 2009 (UTC) | ||
+ | |||
+ | :I guess it depends on what draw() does? I can see the strategy pattern there (different window types draw themselves differently) but I think most of the time draw() inherits some behaviour from the base class and extends it, so it doesn't really fit into the strategy pattern -- it's not just about changing behaviour of an object but also its data (a window with a scrollbar has more elements). --[[User:TobiW|TobiW]] |
Latest revision as of 03:01, 25 November 2010
While coding, I keep thinking about the effects of combining multiple design patterns. So I created this page to discuss it! --Matthew Harward 00:38, 5 August 2009 (UTC)
- Oh, and I claim dibs on the term super-patterns 'cos I think its awesome! --Matthew Harward 00:39, 5 August 2009 (UTC)
Observer + Observer got me thinking old an old idiom in Java - Throwable... To state an already well discussed idea, wouldn't it be cool to implement real world objects as being throwable. E.g. One could have Frisbee, Ball and Fish all extending Throwable. --Matthew Harward 01:25, 5 August 2009 (UTC)
Does Composite + Strategy = Decorator? --Douglas 03:23, 5 August 2009 (UTC)
- I think that a decorator often uses a composite pattern like structure for aggregation, but I don't really see how strategy is related... --Matthew Harward 14:59, 5 August 2009 (UTC)
- I guess it depends on what draw() does? I can see the strategy pattern there (different window types draw themselves differently) but I think most of the time draw() inherits some behaviour from the base class and extends it, so it doesn't really fit into the strategy pattern -- it's not just about changing behaviour of an object but also its data (a window with a scrollbar has more elements). --TobiW