Dark Side Of Composite Pattern

Ron Jeffries mentioned this in Refactoring Adding Complexity. Has anyone experienced this, such that they had to refactor to remove the Composite? -- Joshua Kerievsky

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 Group Figure was still a Figure, so I didn't get rid of composite entirely (see Hot Draw). -- Ward Cunningham

Just to clarify the notion ... sometimes you need to UNDO some Once And Only Once 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. -- Ron Jeffries

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



See original on c2.com