Dark Side Of Composite Pattern

RonJeffries mentioned this in RefactoringAddingComplexity. Has anyone experienced this, such that they had to refactor to remove the Composite? -- JoshuaKerievsky

I wrote a series of drawing editors in Smalltalk. The next to last one used composite extensively: everything was a Figure. The last one I wrote in Smalltalk backed off from this because compulsive use of composite didn't buy me anything and it ungrounded me from what I thought things really were. Of course, a GroupFigure? was still a Figure, so I didn't get rid of composite entirely (see HotDraw). -- WardCunningham

Just to clarify the notion ... sometimes you need to UNDO some OnceAndOnlyOnce for a moment, to put things together another way.

Relatedly, not all refactorings make the system better. These ones need to be removed when you realize it. -- RonJeffries

Sounds like an example of Stan Kelly Bootle's Theory of Kludges:-) -- DickBotting


See: CompositeConsideredHarmful, LimitsOfHierarchies, HierarchicalDatabase, TheoryOfKludges

EditText of this page (last edited April 23, 2012) or FindPage with title or text search