I am working on an online web store. It's a simple web store and I have to create domain UML diagrams for the class and show multiplicities. I am kind of confused about the multiplicity that I have came up with. I don't know how to distinguish between composition, aggregation and association. Below is the diagram that I have came up with. Can someone tell me if I am on the right track?
2 Answers
Not too bad. You should not bother to much with aggregation unless you need to deal with memory management or foreign key constraints in database design. Just leave them away.
One important change you should make are the role names for associations. E.g. instead of shippingAddress:Address
declared as attribute use a role shippingAddress
appearing near association on Address
that comes from User
(etc. for the other ones).
Since Address
is sort of a common-place and used all over, you could leave the class out of this diagram and make a separate diagram where Address
is in the middle and all others using it surround it.

- 35,448
- 8
- 62
- 86
I agree with Thomas, but I will show other points so can you adjust your diagram. Please don't see as something destructive. I just believe these tips can help you.
- show multiplicities of every connection
- do not use getter and setter *
- do not use ID's attributes *
- Order makes composition with User (does not make sense have an order with a user related with it and OrderLine makes composition with Order;
- Product make aggregation with OrderLine and Review make composition with Product;
- Manufacturer makes aggregation with Product. ( depend on your system, it can be a composition, but it more likely to be an aggregation).
Remember (the part) makes something with (the whole)
- it does not need to create an attribute in a class if you have a connection with that class, except when you have a list of it,( e.g.1: attribute CreditPayment in Payment and Class CreditPayment );
- You could make a List of Product in Order. After this, you could delete the Orderline Class.
*if you will not generate a code from the model.

- 327
- 1
- 5
- 16