Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between ER diagram and Class diagram

Tags:

I have been given a description and need to draw ER diagram and Class diagram for the description.

Now I am having issue with understanding the differences between these 2 diagrams.
When I draw the diagrams entities of ER diagram becomes classes. I am not sure whether I am in right track.

Please explain me what is the difference and similarities of these two?

like image 703
New Developer Avatar asked Jun 11 '13 17:06

New Developer


2 Answers

From DifferenceBetween.com:

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.

like image 119
Vishanth Avatar answered Oct 23 '22 19:10

Vishanth


ER diagram:-

  • what is contained in the database like the table, relationship, primary key, foreign key, what is a weak entity,

Class diagram:-

  • what is contained in class like attributes, types of attributes, method, the return type of methods, method's parameter, a relationship of a class(inheritance, aggregation etc.). plus there are also about an interface, abstract class.

ORM(object relation mapping):-

  • there are ORM tools available in any language.
  • where you have to create only an ER diagram from that we have to create only class any based on a class it will automatically create a database.
  • so we don't need to create a class diagram.
like image 23
Solanki Vaibhav Avatar answered Oct 23 '22 20:10

Solanki Vaibhav