Talk:Composite pattern
![]() | Computer science Unassessed | ||||||||||||||||
|
|
This has to be one of the most unprofessional UML diagrams I've seen for one of the most common patterns. As per the user above's complaint about the PERL, Java would be a better language, but in interest of neutrality I'd suggest doing the whole thing in a UML sequence diagram to maintain language neutrality. And can't someone with the GoF CD just quote and paste portions outlining the GoF example -- it's much better.
I added two links to discussions on the pattern. What is needed is a realistic example. For instance an example where the pattern is not used and then how refactoring it leads to the pattern. I have found several moderetaly convincing examples on the web but no really convincing one. Concerning language neutrality: UML sequence language is no more neutral than C++ or Java. MikalZiane 12:44, 26 June 2006 (UTC)
I believe the quality of this article is the code examples as there is nowhere else on the web that both explains the theory and show concrete implementations. A encyclopedia should contain an explanation and history and/or a picture and/or video sequence and/or map and/or examples and/or links to other resources of a given topic. This article only does half and should therefore not be shorten in anyway that will limit the way it elaborate on the topic "Composite pattern". Someone should update (or add) a C# 2.0 example with generics. Also an example in Smalltalk should be added for completeness (a C# 2.0 implementation with the [C5] library and a Java implementation with the Java Collections Framework could also be added). --DotnetCarpenter 09:42, 1 November 2006 (UTC)
I think the article would be a lot better if the code examples were consistent with the UML diagram and its explanation. The abstract Component class is stated to "declare the interface for objects in the composition" and "implement default behavior for the interface common to all classes, as appropriate". Neither of these can be seen implemented in the example code. Should the examples be changed to follow the diagram? Should the benefits and drawbacks of having a more complete vs. simple interface in Component class (cf. GoF book items 3 and 4 on pages 167-169) be mentioned, too? --Uffis (talk) 10:51, 12 June 2008 (UTC)
Composite c++ example
I changed the c++ example the old one was awful: horribly indented, compiled with many warnings, segfaulted, obfuscated, etc. This one I believe is much better and doesn't have any warnings under: g++ -o test test.cpp -Wall -pedantic -ansi. Let me know what you think--Michael miceli (talk) 02:43, 30 March 2008 (UTC)