我的UML图的OO设计指南 [英] guidance with OO design of my UML diagram

查看:133
本文介绍了我的UML图的OO设计指南的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请问我对此UML图有何反馈?这是一张简化的图,仅显示了此时故意有实例变量,构造函数和方法遗漏的类的布局和互连性。

Could I please get some feedback on this UML diagram? It's a simplified diagram only showing the layout and interconnectivity of the classes with instance variables, constructors and methods intentionally left out at this point in time.


库存项目简化的UML图

我需要指导的主要内容是面向对象的设计。我是否具有实现接口的正确类,还是应该将接口移动到子类/超类,我是否具有正确的关联,组成,聚合关系...这些东西。因为我还不熟悉UML,所以我希望我已使用适当的约定按照我希望的方式来描述关系。

The main thing I need guidance with is the object-oriented design. Do I have the right classes implementing interfaces or should I move the interface(s) to subclass(es)/superclass(es), do I have the association, composition, aggregation relationships correct...those kinds of things. As I'm still new to UML I hope that I have used the proper conventions to portray relationships the way I intend them to be.

基本上,我在用Java我在其中模拟数据库以获取商店库存的项目。该项目的范围仅需要几个类,但是我将添加接口和其他OO技术以更好地学习面向对象的设计,因为这实质上是我的第一个适当的OO项目(我将一个具体的类扩展到另一个具体的类

Basically I'm doing a Java project where I mimic a database for an inventory of a store. The scope of the project only requires a few classes, but I'm adding interfaces and other OO techniques to learn object-oriented design better, as this is essentially my first proper OO project (I've extended a concrete class to another concrete class here and there but that's about it so far).

几天前我做了一个类似的话题,但后来又增加了一些内容,改变了周围的一些内容,等等。另外,我对OO设计的命令仍然太不稳定,我需要进一步的反馈来帮助我更好地掌握面向对象的设计,并更加自信地使用面向对象的设计。

I made a similar thread a few days ago but have since added a few things, changed a few things around, etc. Also, my command of OO design is still too shaky and I need further feedback to help me gain a better grasp of - and more confidence utilizing - object oriented design.

顺便说一句,RetailProduct应该是抽象的;

RetailProduct, btw, should be abstract; I realized I neglected to italicize after I took the picture.

推荐答案

看起来不错,但我看不到斜体的含义。持久性相关的类。您只需使用方法保存还原 PersistenceManager 类即可。 c>处理序列化。

Looks good, but I don't see the point of the persistence related classes. You just can have a PersistenceManager class with the methods save and restore to deal with serialization.

如果您想要额外的OO点, PersistenceManager 应该是一个接口,然后您将实现 FilePersistenceManager 。因此,很容易实现其他类型的后端,例如 DbPersistenceManager ...

And if you want extra OO points, PersistenceManager should be an interface and then you'd implement FilePersistenceManager. So it would be easily to implements other types of back-ends such as DbPersistenceManager...

这篇关于我的UML图的OO设计指南的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆