对 UML 类图的反馈

发布于 2024-11-03 07:28:18 字数 244 浏览 0 评论 0原文

我正在为剧院的简单预订系统创建一个类图。我想知道该图是否有意义以及是否需要更改任何内容(箭头方向)才能使其正确?

谢谢。 在此处输入图像描述 图片网址:https://i.sstatic.net/zWiGW.jpg

I am creating a Class Diagram for a simple booking system for the theater. I would like to know if the diagram makes any sense and if anything needs to be changed (arrow directions) in order for it to be correct?

Thanks.
enter image description here
Image URL: https://i.sstatic.net/zWiGW.jpg

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

孤君无依 2024-11-10 07:28:18

以下是一些您认为合适的建议,您可以随意采纳或忽略:

  • 我不同意演出和场地之间的关系。让预订来维持演出和场地之间的关系似乎更自然。
  • 我在任何地方都没有看到演出日期。我错过了吗?这似乎很重要。
  • 演出没有座位;场地有座位。
  • 门票应使您有权在特定日期获得场地的座位。我不这么认为。
  • TicketType 应该只是一个枚举。
  • 将 User 分解为 Name、Address 和 Credential 类。将凭证与用户分开。
  • 真正的支付系统需要的远远超出您所展示的内容(例如信用卡等),

我认为您的模型需要做很多工作。

Here are some recommendations that you're free to incorporate or ignore as you see fit:

  • I don't agree with the relationship between Show and Venue. It seems more natural to have a Booking maintain the relationship between a Show and a Venue.
  • I don't see a Date for a Show anywhere. Did I miss it? That seems important.
  • Shows don't have Seats; a Venue has Seats.
  • A Ticket ought to entitle you to a Seat in a Venue on a particular date. I don't see that.
  • TicketType should be nothing but an enum.
  • Decompose User to have a Name, Address, and Credential classes. Separate the Credentials out from User.
  • A real payment system would need far more than what you have showing (e.g. CreditCard, etc.)

I think your model needs a lot of work.

温馨耳语 2024-11-10 07:28:18

除了达菲莫所说的之外,这里还有一些与该特定图表并不严格相关的一般观察结果,而是与您的建模实践相关。

  • 如果关联是单向导航的,则无需命名两端。您已命名了所有关联的两端,但只有可导航端需要名称。

  • 从所有关联末端删除“can”。在某些情况下,有一个方便的术语,例如节目可以在场地举办。但在其他情况下,将关联端命名为与该端的类相同的名称是完全可以的,甚至是常见的做法。 (因此将席位端简单命名为 Seats

  • 如果可以的话,避免多对多关系。如果您不能考虑在两者之间添加关联类,它几乎总是有意义的。

In addition to what duffymo said, here are some generic observations not strictly related to this particular diagram but rather you modeling practices.

  • If an association is one way navigable then there is no need to name both ends. You have named both ends of all associations, but only navigable end needs a name.

  • Drop the 'can' from all association ends. In some cases there is a handy term, for example show can be hosted at a Venue. But in other cases it's perfectly fine and even common practice to name association ends same as the class at that end. (so name the Seat end simply Seats)

  • Avoid many to many relationships if you can. If you can't then look into adding an association class in between, it almost always makes sense.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文