0
Under review

Description of Aggregation in the design patterns book

Gihwan Oh 2 years ago updated by Alexander 2 years ago 2
On pages 22-23, the book is saying about aggregation. The example is about the Department and the Professor classes. 
But the last paragraph refers to the University object and the Department object. It's not consistence with an example diagram. 
Is this intended? or could you fix this? 

And also, about the Composition, you say that the component can only exist as a part of the container. Does this mean that a Department class can't be instantiated with a University class? 

Comparing aggregation and composition, I feel obfuscated about the difference between them. Could you give me a concrete example of the difference? Or, is there any related chapter later in the book?

+1
Under review

Hi!

Imagine a youtube video player.

The relation between the play button and the player itself is a composition — the play button doesn't make sense outside of the player.

Now, imagine a playlist with a bunch of players. The relation between each player and the playlist itself is an aggregation — a player can both exists independently or as part of a playlist.