开发者

Check my UML Class Diagram

开发者 https://www.devze.com 2023-02-05 22:56 出处:网络
Can someone check my class diagram because I am not too good at drawing this type of uml diagram A User can be 开发者_StackOverflow社区a PersonalUser or a BusinessUser

Check my UML Class Diagram

Can someone check my class diagram because I am not too good at drawing this type of uml diagram

  1. A User can be 开发者_StackOverflow社区a PersonalUser or a BusinessUser
  2. An Administrator is a special type of PersonalUser
  3. A PersonalUser or BusinessUser can create many Auction
  4. But an Auction can be created by only one PersonalUser or only one BusinessUser
  5. There an Auction cannot exist without an PersonalUser or a BusinessUser
  6. An Auction can contain only one Item
  7. An Item can be in only one Auction
  8. An Item cannot exist without an Auction
  9. An Auction cannot exist without an Item
  10. An Item has one Category
  11. Category can has many item
  12. An Item cannot exist without a category
  13. A Category can has a Parent Category but this is not mandatory
  14. A Category can has many Attributes
  15. But an Attribute is for only one Category
  16. An Attribute cannot exist a Category
  17. An Attribute can has many AttributeOption
  18. But an AttributeOption is linked to only one Attribute
  19. An AttributeOption cannot exist without an Attribute
  20. An Auction can has many bids
  21. A bid is only for one auction
  22. A Bid cannot exist without an Auction and a Personal User or a BusinessUser
  23. An Item can has many picture
  24. A picture is only for once item and a picture cannot exist without an Item
  25. A User can create many ForumTopics but a ForumTopic can be created only by one User
  26. A ForumTopics can contain one or more ForumMessage
  27. A ForumTopic cannot exist without a User and a ForumMessage cannot exist without a ForumTopic
  28. A BusinessUser can has many BusinessContactNumber but a BusinessContactNumber is only for one BusinessUser
  29. A BusinessContactNumber cannot exist without a Business


At first glance, you used a lot of aggregations. This is quite uncommon. I have never seen a good example of when an aggregation is justified. It's usually either a plain association (no whole-part relationship) or a composition (the part is deleted when the whole is deleted).

Cannot exists without does not imply aggregation. A proper multiplicity is sufficient. Can create does not imply aggregation. Creation is usually modeled with an appropriately stereotyped use-relation (i.e. dashed arrow), unless an association between the creator and the creation exists (in which case creation need not be mentioned explicitly).

4 But an Auction can be created by only one PersonalUser or only one BusinessUser.

Then the multiplicity of the Auction-PersonalUser association cannot be 1 at the PersonalUser end (because the Auction might have been created by a BusinessUser) and the multiplicity of the Auction-BusinessUser association cannot be 1 at the BusinessUser end (for much the same reason). Use 0..1 as multiplicity, but beware of what I will write about 3.

3 A PersonalUser or BusinessUser can create many Auction

This is equivalent to a User can create many Auction.

6 An Auction can contain only one Item

7 An Item can be in only one Auction

8 An Item cannot exist without an Auction

9 An Auction cannot exist without an Item

Then there is a single association between Item and Auction with multiplicity of 1 at both ends. Don't make aggregations out of it and don't use two associations for it.

13 A Category can has a Parent Category but this is not mandatory

That would be made clear if you label the association ends.

25 A User can create many ForumTopics but a ForumTopic can be created only by one User

This is only vaguely related to Auctions and might as well exists independent of them. Put the Forum stuff into a separate package. Then maybe the auction stuff and the user stuff also deserve a separate packages.

BTW: You did not mention the Bidding Service. It seems solely to model the concept of theses objects do not exist in thin air, they are actually used by some software. In that case, leave it out.


I largely agree with previous respondent, so I will present only differences and additional opinions.

To be a bit more precise, "Can create..." should be depicted using dependency relationship (not uses).

  1. It is not entirely equivalent if some distinction should exist. You might use User class with an enumeration or UserType class if you want to avoid enumerations for some reason.

6.-9. So no Auction or Item object can exist. Either loosen the relationship in one way and use composition or merge those two to one class or create an association class.

  1. Maybe one category can contain many subcategories? If true, edit the corresponding multiplicity.

  2. Same as 4., view the other answer.

Also rethink the amount of classes in your design. Classes are not just data holders, they should have behaviour. What will be the behaviour of AttributeOption or Attribute or BusinessContact etc? Getters and setters do not count for a behaviour... I guess you planned to have all of this behaviour in BidingService, so I advise you to remove it and split those methods according to what class of objects should be responsible for behaviour achieved through the respective method.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号