Reputation: 47
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?
Upvotes: 0
Views: 1868
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:
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