【发布时间】:2011-09-30 08:20:44
【问题描述】:
“类图”和“对象图”的含义有区别吗?
【问题讨论】:
标签: oop uml class-diagram object-graph
“类图”和“对象图”的含义有区别吗?
【问题讨论】:
标签: oop uml class-diagram object-graph
查看本教程 http://www.cs.toronto.edu/~jm/340S/Slides6/ClassD.pdf
对象图包含类的一个实例的值,请参阅example View,它是对象系统在特定时间点的视图
同时
类图作为wiki
The class diagram is the main building block of object oriented modelling. It is used both for general conceptual modelling of the systematics of the application, and for detailed modelling translating the models into programming code. Class diagrams can also be used for data modeling.[1] The classes in a class diagram represent both the main objects and or interactions in the application and the objects to be programmed. In the class diagram these classes are represented with boxes which contain three parts: [2]
A class with three sections.
The upper part holds the name of the class
The middle part contains the attributes of the class
The bottom part gives the methods or operations the class can take or undertake
【讨论】:
我同意上一篇文章,但想补充一点,类图是基于 UML 的,UML 是一种由 OMG 赞助并为超过 500 万用户所知的认可语言。因此,UML 是一种基于模型的标准,您可以从中获取视图。
在 UML 2 中,如果与 Java 一起使用,类图非常棒,因为在我看来,新规范与 Java 项目具有完全相同的结构。它包括一个项目名称,包包括分类器(例如类、接口、枚举),其中包括属性,方法包括属性。
如果你只能使用一张图,我会说使用类图。它很容易创建,因为您不需要了解 UML,并且可以将您的项目逆向工程为模型以获得类图视图。我的类图简直太神奇了:-)
【讨论】:
类图表示类名、属性和行为,而对象图表示类图的实例,对象图在类图之下
【讨论】: