对于数据库分析,类图和 ERD 哪个更好?
我以前曾使用类图来分析数据库。但现在,我认为类图和 ERD 之间有所不同。哪一个是完全的?
这些图有什么不同和相似之处?
I've used class diagram for analyses database before. but now, I'm thinking different between Class diagram and ERD. which one is completely?
what is different and similarity between these diagram?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
什么是 ER 图?
ER 图是实体关系建模的产物。实体关系建模是提出数据的抽象和概念表示的过程。 ER 图最终对数据库进行建模。更具体地说,它生成数据模型的概念模式。 ER 图的主要构建块是实体、关系和属性。实体代表一个可以独立存在、可以唯一定义的事物。大多数情况下,实体代表现实世界的对象,例如汽车或员工。实体可以被视为在描述要解决的问题时出现的名词。关系显示实体如何连接。它们就像在要解决的问题的描述中找到的动词。实体和属性的属性都称为属性。
什么是类图?
类图(更正确地称为 UML 类图)是一种设计图,它表示所提议系统的静态结构和行为,使用 UML(统一建模语言)定义。类图显示系统的类、类之间的关系及其属性。类描述了现实世界对象的抽象表示,而关系则描述了每个类如何与其他类连接。类和关系都具有称为属性的属性。类中的方法表示或定义这些类的行为。类的方法和属性称为类的成员。
ER图和类图有什么区别?
虽然ER图和类图是开发人员在软件工程项目的设计阶段经常遇到的两种设计图,但它们有其关键的区别。 ER 图表示数据模型的抽象表示,而类图表示所提议系统的静态结构和行为。 ER 图的主要构建块是实体、关系和属性,而类图的主要构建块是类、关系和属性。类图更有可能映射到现实世界的对象,而 ER 图最常映射到数据库中的表。通常,ER 图中的关系比类图中的关系更难于人类理解。
了解更多:link1 - link2 - link3
What is ER Diagram?
ER diagrams are the product of entity-relationship modeling. Entity-relationship modeling is the process of coming up with an abstract and conceptual representation of data. ER diagrams ultimately model the databases. More specifically, it produces the conceptual schema of the data model. Main building blocks of ER diagrams are entities, relationships and attributes. An entity represents a thing that can exist independently and that can be defined uniquely. Most often, an entity represents a real world object such as a car or an employee. Entities can be though of as nouns that come up during the description of the problem to be solved. Relationship shows how entities are connected. They are like verbs found in the description of the problem to be solved. Properties of both entities and attributes are called attributes.
What is Class Diagram?
A class diagram (more correctly known as a UML class diagram) is a design diagram that represents the static structure and the behavior of a proposed system, defined using UML (Unified Modeling Language). A class diagram shows the systems’ classes, relationships between classes, and their attributes. Classes depict the abstract representation of real world objects, while the relationships depict how each class is connected to others. Both classes and relationships have properties called attributes. Methods in the classes represent or define the behavior of these classes. Methods and attributes of classes are called the members of the class.
What is the difference between ER Diagram and Class Diagram?
Although ER diagrams and Class diagrams are two of the design diagrams developers often come across during the design phases of software engineering projects, they have their key differences. ER diagrams represent the abstract representation of the data model, while class diagrams represent the static structure and behavior of the proposed system. Main building blocks of ER diagrams are entities, relationships and attributes but the main building blocks of class diagrams are classes, relationships and attributes. Class diagram are more likely to map in to real-world objects, while ER diagrams most often map in to the tables in the database. Usually, relationships found in ER diagrams are more difficult to understand for humans than relationships in class diagrams.
Read more: link1 - link2 - link3
实体/关系图通常没有继承等面向对象的概念。
您可以根据对象组合 HAS-A 来考虑一对一、一对多和多对多关系,但显示肯定不同。
Entity/relationship diagrams don't usually have object-oriented concepts like inheritance.
You can think of one-to-one, one-to-many, and many-to-many relationships in terms of object composition HAS-A, but the display is certainly different.