Created November 8, 2009
Last updated November 8, 2009
[ Japanese | English ]

Class diagram , Entity-relationship diagram and Extraction of the class

  In this page, first of all, I will explain the Relation between class diagram and ER diagram 1.
  Afterward, I will explain the extraction of the class.

-----
Note.
1:The ER diagram is a range of the Fundamental Information Technology Engineer Examination (FE) , the Software Design & Development Engineer Examination (SW) , the Database Systems Engineer Examination (DB) and so on of the Japan Information-Technology Engineers Examination. If you aim at passing , study it.


1. What is the class diagram?
2. What is the ER diagram?
3. The relation between class diagram and ER diagram
4. The extraction of the class
5. Reference


1. What is the class diagram?

  The class diagram is the diagram that describes the attributes and operations of the class and the associations of the classes.

  If you want to look at the example of the class diagram, please look at "Classes and Objects  4. Example2(Student information and results of examinations)" (opens in new window).

Back to Top

2. What is the ER diagram?

  The ER diagram ( Entity-relationship diagram ) is the diagram that is used to design the tables of the RDB ( Relational Database ).
  The ER diagram is the range of the Fundamental Information Technology Engineer Examination (FE) , the Software Design & Development Engineer Examination and so on of the Japan Information-Technology Engineers Examination. Especially, If you aim at passing the SW, you should be able to create the ER diagram and understand the SQL.
In details, I think that you should understand the primary keys, foreign keys, indexes, normalization and cardinality, and you should understand the Select statement , Update statement , Dalete statement , Where clause , Join(left join etc.).

  I am sorry for the story's wandering.
  Because this home page is the page of the Excel VBA , I think that the person who look at this don't know the ER diagram and SQL.
  And so, I will explain the easy exercise.

Exercise:There is data shown in Figure 1. Draw the ER diagram.


Figure 1 - Student information and result information
This is the same diagram as "Classes and Objects  4. Example2(Student information and results of examinations)"

Answer:


Figure 2 - ER diagram extracted from student information and result information
This diagram is created by DB Designer Fork.

Explanation:
  There are various mark methods of ER diagram. Sorry , I don't know the method of Figure 2.
  By the way, in the Japan Information-Technology Engineers Examination , the method is specified by the examination.


  "INTEGER" is the numeric type.
  "VARCHAR(255)" is a character string up to 255 characters or less.
  "DATE" is the date type.
  And, the key mark in the left of the attendanceNumber of the StudentInformation entity and so on means the primary key. The primary key is the attribute in which data ( row ) is uniquely identified ( the row of the ResultInformation table is uniquely identified by the attendanceNumber and testDay) .
  "(FK)" in the right of attendanceNumber of the StudentInformation Entity means foreign key.
The StudentInformation and the ResultInformation is connected. This means relationship of 2 entities. In this case, 1 : n , this means that one student data is related plural result datas and one result data is related one student data.

  The difference between this ER diagram and the class diagram of "Classes and Objects  4. Example2(Student information and results of examinations)" is that in the ER diagram there is the attendanceNumber of the ResultInformation and isn't derived attributes (totalScore and averageScore).
Back to Top

3. The relation between class diagram and ER diagram

  I will explain the relation of the class diagram and the ER diagram.
  The class diagram and the ER diagram look like.
  I think that the origin of the class diagram is the ER diagram. Therefore , these look like.
  If you want to understand the class diagram, you should previously understand the ER diagram.

  Table 1 is relation of the class diagram and the ER diagram. Please refer.

Table 1 - The relation of the class diagram and the ER diagram
"-" means that there isn't corresponded.
"?" means that I don't know the corresponded name.
Attention: I arranged the one which the meaning was near.

ER Diagram

RDB

Class Diagram

Discription

Entity Table Class Difinition of the entity.
? Record,Row etc. Object
Attribute Attribute,Column etc. Attribute
- - Operation In the ER diagram, the entity don't have operations.
Because, the design in the ER diagram is not OOA ( Object-oriented approach ) but DOA( Data-oriented approach). ( The design in DOA is thought that datas and oprations divided)
Relationship Relationship Association This is a line of connectting the entities or classes.
Cardinality Cardinality Multiplicity There are "1:1" , "1:n" and "n:m".
Super type , Sub type Super type , Sub type Super class , Sub class This is a inheritance.
In the ER diagram, there is originally no idea of the inheritance. I think that the ER diagram is introduced the idia of the object-oriented.
Recently, this is made an examination question by the Database Systems Engineer Examination ( DB ) of the Japan Information-Technology Engineers Examination.
third normal form ? ? When you design the ER diagram, I think that you normalize datas.
When you design the class diagram , I think that you should do so.
? Related table Association Class When The cardinality or multiplicity is "n:m" , this is defined to make it to "1:n" and "1:m".



Back to Top

4. The extraction of the class

  I explained the point of the class diagram and ER diagram that looked like was variously a lot of.
  The extraction of the class ( where only the entity class) is looked like the entity of the ER diagram too.

  Therefore, I think that if you can extract entities in the ER diagram, you can extract classes in the class diagram.
  But, because there is difference points , please pay attention to it.
  The following is that I know.

  1. There are a little difference of the idea of the association. In the class diagram , the association is the same meaning as the attribute ( Two are generically called a property. ). In the ER diagram, if the relationship is needed , the foreign key is needed too.
  2. In the ER diagram, the inheritance is not possibility drawn. ( When RDB don't tread the inheritance)
  3. In the ER diagram, only permanent datas are often designed. But , in the class diagram , not permanent datas are designed too.
    (Note: In the class diagram, only permanent datas are occasionally designed. Because the class diagram and ER diagram are common methods of drawing, use has not been limited.)
  4. In the ER diagram, derived attributes and read-only attribute are not designed. But , in the class diagram, those are designed.
  5. There is difference of names and notations.
About 1 and 2 , If you need , search "object relational impedance mismatch" and so no by Google.
Back to Top

5. Reference

  The following table is pages that I refered to create this pate.

No.

Linked Website Name

Description

Linked date

1 DB Designer Fork | Get DB Designer Fork at SourceForge.net Download site of DB Desiger fork November 8, 2009
2 Entity-relationship model - Wikipedia, the free encyclopedia This pate explain ERD. November 8, 2009
3 Third normal form - Wikipedia, the free encyclopedia This pate explain Third normal form. November 8, 2009


Prev Up Next  Top
Back to Top

I doesn't assume the responsibility of any damage that occurs because of the use of this page.

Microsoft ,Windows ,Visual Basic and Excel are registered trademarks of Microsoft Corporation in the United States and other countries.
Visual Basic® for Applications may represent a VBA.
Mac ,Mac OS ,Mac OS X ,AppleScript are trademarks of Apple Inc., registerd in the U.S. and other countries.
Google is trademarks of Google Inc.
Other brands and their products are trademarks or registered trademarks of their respective holders and should be noted as such.

The author of this page and these companies do not have any relationship.