合作伙伴商店的可用性产品库存的设计对象

发布于 2024-09-13 04:24:25 字数 176 浏览 3 评论 0原文

允许商店是否有其他商店合作伙伴的库存中的产品,后者可以接受或拒绝该请求,在所有情况下都会通知申请人答复。

我想实现一个图表类。 现在我有一个类产品,以及一个类产品集合列表。 我不知道如何表示“产品可用性请求”的操作类。

是否有与这种情况相对应的设计模式?

或者一个简单的类图示例将受到欢迎。

Allowing a store whether a product is available in the stock of another store partner, the latter may either accept or reject the request, in all cases the applicant is informed of réponse.

I want to implement a diagram class.
Now I have a class product, and a class list of collections of products.
I don't know how to represent a class of operation "request for product availability.

Is there a design pattern corresponding to this situation?

or a simple example of class diagram would be welcome.

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

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

发布评论

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

评论(1

如果没结果 2024-09-20 04:24:25

我假设您正在谈论用一些合适的图表来表示您的设计,在这种情况下,您需要学习一些“建模语言”——当今最广泛使用的可能是 UML。这是一个很大的主题,但您可以从此处开始。

现在,只有当您的设计达到一定程度的复杂性时,此类图表才真正有用。在这里,您只考虑几个类和一种方法,图表没有多大帮助。那么也许您这样做是为了学习练习?

您可能需要类图和序列图

您似乎感到困惑的主要问题是如何表示操作,它们只是针对类列出的。所以你的 Store 类将有一个操作 transferInventory()。

所以你的类图非常简单,只有几个类 Store,Product。但有趣的是,您的序列图将显示您有多个 Store 类的实例:StoreA、StoreB,并且这些实例相互通信。

您还没有谈论过的一件事:StoreA 如何知道 StoreB 存在?为什么选择该商店来索取产品?这里还有一些额外的类,例如商店注册表。我对弄清楚这一点比绘制图表更感兴趣。

I'm assuming that you are talking about representing your design in some suitable diagram, in which case you need to study some "Modeling Language" - probably the most widely used today being UML. This is a big topic, but you could start here.

Now diagrams such as these are really only useful when your design reaches some level of complexity. Here you are thinking about just a couple of classes and one method a diagram won't help much. So maybe you are doing this as a learning exercise?

You probably need both a Class diagram and a Sequence Diagram.

The major thing you seem to be confused about is how to represent Operations, they are just listed against the class. So your Store class would have an operation transferInventory().

So your class diagram is very simple only a couple of classes Store, Product. But the interesting thing is that your Sequence diagram will show that you have more than one instance of the Store class: StoreA, StoreB and the instances communicate with each other.

One thing you haven't talked about: how did StoreA know that StoreB exists? Why did it choose that Store to ask for a product. There's some additional classes here such as a registry of Stores. I would be much more interested in figuring out that than in drawing diagrams.

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