我可以使用我的关系数据库表图来创建 UML 类图吗?
我是 UML 新手。但我很擅长绘制数据库表及其关系。
我可以通过添加下面的Methods() 来“扩展”这些表并将其称为UML 类图吗?
学生
........................................
StudentID : int
StudentNumber : string
FirstName : string
Surname : string
.... ......................
显示()
更新()
添加()
删除()
I am new to UML. But I'm well versed in drawing db tables and their relationships.
Can I just "extend" these tables by adding Methods() below and call it a UML Class Diagram?
Student
..........................
StudentID : int
StudentNumber : string
FirstName : string
Surname : string
..........................
Display()
Update()
Add()
Delete()
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为每个表创建一个对象并不是一个好的做法。并不是每个表都需要成为 UML 中的对象...但是话又说回来...我认为这更适合 StackOverflow...
Making an object for every table isn't a good practice. Not every table needs to be an object in your UML... But then again... I think this is more for StackOverflow...
您似乎具备 UML 基础知识。主要区别在于关系类型与 SQL 不同,并且 Java(或任何语言)数据类型不直接与 SQL 数据类型匹配,因此您需要像上面那样进行转换。
[意见] 除非你有 UML->代码->UML 工具,否则我不会太沉迷于绘制 UML。它主要是一个白板工具(恕我直言),从长远来看,当维护更改使此类文档过时时,信任这些图表往往会伤害您。在查看遗留代码时,我更喜欢使用代码->UML 工具,而不是设计时过时的 UML 图。 [/opinion]
[edit] 由于您已经有了工作代码,您可能需要尝试 Amateras UML。您可以将一堆类拖到一个空文档上,它将为您创建 UML 图。 [/编辑]
You seem to have the basics of UML. The main differences are that relationship types are different from SQL and that Java (or whatever language) data types don't match SQL data types directly, so you'll need to convert those as you have above.
[opinion] Unless you have a UML->code->UML tool I would not get too hung up on drawing the UML. It's mainly a tool for white boarding (IMHO) and trusting those diagrams tends to hurt you in the long run when maintenance changes make that sort of documentation obsolete. I prefer to use a code->UML tool when looking at legacy code rather than outdated UML diagrams from design time. [/opinion]
[edit] Since you already have working code you may want to try Amateras UML in Eclipse. You can drag a bunch of classes onto an empty document and it will create the UML diagram for you. [/edit]