CrushJelly
CrushJelly

Reputation: 47

How to improve/edit in this UML class diagram?

How can I improve this UML class diagram and what mistakes I made?

I'm really confused about the relationship between Expense and Category, because Category and Expense can exist by themselves: you can register Expense and not assign it to a category, or do the opposite, you can add new Categories to the categories list, and so on...

Do I really need separate List classes?

enter image description here

Upvotes: 0

Views: 1868

Answers (1)

qwerty_so
qwerty_so

Reputation: 36313

I would just make your CategoryList the Category class and delete the latter. I don't know your domain, but assuming an expense can be assigned one or more categories you can clarify this by adding a multiplicity. You should also drop the shared composition (hollow diamond) as it does not add any real information to your model.

Edit According to your comment I would model it like this:

enter image description here

The representation of Category as a list would be task of some View or Controller that represents existing categories. One could think of your CategoryList class as such a controller.

Upvotes: 1

Related Questions