Hello, Does any know of an official place with all the possible connections between elements in a UML diagram ? I see a lot of discrepancies between different books and websites on the meanings of these connections. For example, according to Mark Cade's book, a solid line with filled diamond is 'aggregation'. But at other places I read it as 'containment' while aggregation is a solid line with empty diamond. Do these details matter in the exam ? In that case, where is everybody reading them from ? Cheers, Ram.
A filled diamond with a solid line represents a composition whereas an empty diamond with a solid line represents an aggregation. Often composition is referred to as containment by value and aggregation is referred to as containment by reference. The key difference is this. In a composition relationship the life of the part is closely tied to life of the whole. When the whole object is deleted, parts also get deleted. Whereas in an aggregation, the whole simply acts as a bucket for (references to)the parts and when you delete the whole, parts will continue to exist. Composition is usually applied to "physical" containment whereas aggregation is applied to logical relationship between the part and the whole. The relationship between a book and its pages is a composition. When you delete the book, the pages will get deleted with it. The relationship between an order and its order items is an aggregate relationship since, when you cancel an online amazon.com order, only the order "entity" gets deleted whereas the books ordered will continue to exist in the inventory. IMO it is very important to get the differences clearly shown in your class diagram. I suggest that you refer to a good UML book/tutorial before using these relationships in your class diagram. When in doubt, just use a generic one-to-many or zero-to-many relationship without depticting the association as either an aggregation or composition.
Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
Thanks so much for the reply, Ajith. It helps a lot. And I am still preparing for my part I, so I won't be using the diagrams yet . I wanted to find out if the part I would have such questions describing the line and arrows and asking to figure out what it describes. A few mock tests had such questions. Thanks again, Ram.