Well, when drawing a class diagram, the aggregation and composition are not very clear. It's even more confusing for colleagues to speak. Find a post to learn
Http://www.blogjava.net/lukangping/archive/2010/08/01/327693.html
Aggregation : Represents a weak relationship between the whole and the parts of two objects, and part of the life cycle can go beyond the whole . such as a computer and mouse, you can use a shape to indicate:
combination : Indicates that two objects are strong relationships between the whole and the part, and that part of the life cycle cannot go beyond the whole, or be absent from the whole . The "part" of a combined relationship cannot be shared across the whole. such as the relationship between human and eye:
After reading the above words, personally think. If you kill a object, then the B object inside a object can also exist is aggregation, if a object you to kill, while a object is killed at the same time B object will inevitably disappear is the combination. Like a man dead, his eyes must be dead. But the host has broken the mouse can also use.
The other two more important relationships are associations and dependencies:
Association: It is simple to think that if a class is a property of another class, it must be an associative relationship (the meaning of the attribute: Class A has an object of Class B or a pointer). But you know, aggregation is a special kind of association, and a combination is a special kind of aggregation . The General Association we think is a lateral, not integral part of the relationship, such as a friend relationship.
dependency: A temporary relationship between objects that is temporarily reflected in a cycle that does not transcend the method (class B is used in a method of the class). Simply put, in a method used, such as the parameter class, it must be a dependency relationship.
Finally, I would like to say that the actual work, I did not find the distinction between the four kinds of relationship is of great use, perhaps I have not met, just think that every student learning it always want to make it clear, but the role of the actual work is not obvious.
Differences in aggregation and composition