It would be interesting if somebody would add a small section discussing this. A Google search on this topic suggests that these are comparable solutions to the
| This article is rated Start-class on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | ||||||||||||||||||
| ||||||||||||||||||
It would be interesting if somebody would add a small section discussing this. A Google search on this topic suggests that these are comparable solutions to the same problem of class relationships, except the composition allows for runtime hierarchy management. An example demonstrating this comparison would be interesting. --Daydreamer302000 (talk) 08:01, 11 May 2009 (UTC)
Below the UML diagram, there is a piece of code showing composition: a car is composed of one carburetor. The car class however, contains a pointer to a carburetor. This is in contrast with the code examples in the point above, where is stated that composition uses an 'object within object' structure, whereas aggregation uses a reference/pointer to the object. In my opinion, if I have understood correctly, the car/carburetor example should be without pointer. it also shows what the sun is. --Patrickdepinguin 19:05, 18 June 2006 (UTC)
The UML samples should be given multiplicity. On the owning (diamond) end of the association, for aggregation, the multiplicity, can be any multiplicity (except for 0..0), including 1, 0..1, 0..*, and *. For composition, the owning end can only be 1 or 0..1 --Mjchonoles 13:53, 18 May 2006 (UTC)
I think aggregation should get its own article and that composition should only mention the differences briefly...
The subject "Record (database)" redirects here, but this page is rather complicated. I recommend an article under "Record (database)", with a link to this page, rather than a redirect. D021317c 05:56, 21 March 2007 (UTC)
The final paragraph of introduction had been copied as "UML Notation" (near the end of the article). "Aggregation" section also has an UML diagram, so "UML Notation" must be introduced before. Rjgodoy 01:37, 17 April 2007 (UTC)
Assembler is definately the source of whole idea of "record". Could someone add assembler code as the first item in the timeline? Unfortunately I don't know any pre-COBOL assembler, such as S/360, but it would be perfectly logical here (I guess even zSeries would be better than nothing). --Kubanczyk 19:16, 18 October 2007 (UTC)
IMHO, records in assembler are just a region of memory plus an implicit convention of using such region for storing certain kind of data (nibbles, BCD, bit-flags, etc). I mean there is no assembler notation for declaring "records" besides the directives for reserving memory. Rjgodoy 15:28, 19 October 2007 (UTC)
This section may benefit from improvement, or possibly an image (see User talk:Rjgodoy/1). Shinobu (talk) 16:10, 7 January 2008 (UTC)
Image talk:AggregationAndComposition.svg A user has requested that "Ducks" in AggregationAndComposition.svg be spelled "Duck" (singular). I think it makes sense, but I have no tools for editing svg. Rjgodoy (talk) 16:57, 20 February 2008 (UTC)
The example is questionable, especially the way in which it is phrased.
Essential to composition is that the part has a necessary link with a whole, but a wheel can exist separately from a car. The example should therefore make it clear that the wheel being regarded as part of a car is not so much a property of wheels and cars as it is a property of a possible model of cars. I don't think the independent functioning of cars and wheels has much relevance, what matters is how wheels are identified within the system. Agree? Rp (talk) 09:50, 30 March 2009 (UTC)
The equivocation of composites with "record types" is equally questionable. For instance, the recursive struct example of a binary tree is inconsistent with the definition of a composite relationship as one in which existence of the members depends on existence of the whole. More generally, this is true for values in a record/struct, but if these values are pointers to objects el;sewhere, not for those objects. This should be clarified. Rp (talk) 19:19, 15 March 2010 (UTC)
In code sample you can see:
create dept()
AFAIK, there is no create keyword in C++ —Preceding unsigned comment added by Vanuan (talk • contribs) 17:30, 16 September 2010 (UTC)
On the first picture, the reresentation of aggregation and composition are in conflict with the text and code example. Aggregation should be an unfilled diamond, composition should be a filled diamond, but the symbols on the picture seems inverted. —Preceding unsigned comment added by 131.254.10.229 (talk) 16:21, 11 April 2011 (UTC)
You cannot construct R due to infinite recursion in __init__. Not sure what this example is trying to illustrate... — Preceding unsigned comment added by 213.152.225.82 (talk) 18:51, 25 September 2012 (UTC)
The article is confusing because it makes no difference with composition and composite object (or structures) that are different things. Composition involves objects declared separately and then composed and that is similar to multiple inheritance. Composite objects are just objects made of other objects. Macaldo (talk) 14:25, 9 June 2014 (UTC)
Is it an attempt to show how composition looked in 1984 for C++ for instance? I can't think of a more confusing example in modern C++ (look at the other examples in C++?). Is it the same for other languages? Niberto (talk) 10:53, 15 January 2016 (UTC)
This article lacks of references when it claims that composition is conceptual and not related to the implementation. It therewith lacks of neutrality, taking a purely conceptual point of view, and disregarding OOP reality, which makes it somewhat inconsistent with the section on object composition in the Object-oriented programming article.
The article should therefore be revised to clarify the difference between:
This article contributes to some confusion, leading people to use aggregation in design models instead of simple associations, just because they intend to use object composition at implementation level, a phenomenon that James Rumbaugh, one of the UML founders use to call "modeling placebo".
The revision could also be the opportunity to make the second sentence less ambiguous ("related to but ....") and explain the semantic differences in composition using reference types and value types.
Lastly it could remove some contractions such as:
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.