Difference between ER Chart and Class Chart

I have been given a description and you need to draw an ER diagram and a class diagram for a description.

Now I have a problem understanding the differences between the two charts.
When I draw charts, ER chart objects become classes. I am not sure if I am on the right track.

Please explain to me what is the difference and similarity of the two?

+8
source share
4 answers

From DifferenceBetween.com :

ER diagrams are an abstract representation of the data model, while class diagrams represent the static structure and behavior of the proposed system. The main building blocks of ER charts are objects, relationships, and attributes, but the main building blocks of a chart class are classes, relationships, and attributes. The class diagram is more likely to display in real-world objects, while ER diagrams most often refer to tables in the database. Typically, relationships found in ER diagrams are harder to understand for people than relationships in class diagrams.

+7
source

ER Chart: -

  • what is contained in the database, for example, a table, relation, primary key, foreign key, which is a weak object,

Class Diagram: -

  • what is contained in the class, for example attributes, attribute types, method, return type of methods, method parameter, class connection (inheritance, aggregation, etc.). plus there is also about the interface, an abstract class.

ORM (object relationship mapping): -

  • ORM tools are available in any language.
  • where you should only create an ER diagram, from which we should create only a class based on the class, it will automatically create a database.
  • therefore, we do not need to create a class diagram.
+1
source

When you think about class diagrams, you think about organizing behavior or just functions. For example, calculate the cost function using state tax information. Then you can have different classes representing different calculation functions (see the Strategy Template from GoF Design Templates).

When you think about the ER diagram, you think about the rules of existence and the relationship of the data that will be stored. A user account must have a username, and a bank account can have only one primary user account.

To summarize, we can say that with class diagrams you are thinking about organizing behavior / functions, while with ER diagrams you are thinking about organizing data assets. They are uniquely related when creating the entire application, but have two different perspectives in the design of the created application.

Hope the explanation helps!

+1
source

There are many ways to tell the difference between an ERD and a class diagram.

For example, ERD, also known as Entity Relationship Diagram, displays only system functions. On the other hand, the class diagram displays the most important sections of the system, system and behavioral features.

In the Unified Modeling Language (UML), objects are displayed as plain text in a class rectangle. However, in the entity relationship diagram, objects are ovally related to the entity type.

An ER diagram has relationships that are more complex than class diagrams and more difficult for people to decipher. An ER diagram contrasts with a class diagram because it is displayed in tables in the database, while a class diagram is displayed in real objects.

Another difference is that the class diagram has some relationships that are not implied and are not modeled in the entity relationship diagram.

The main segments of entity relationship diagrams are composed of entities, relationships, and attributes, while classes, relationships, and attributes are segments of class diagrams.

Hope this helps someone!

0
source

Source: https://habr.com/ru/post/1485662/


All Articles