Chapter 5 – Class Diagram

1.What is the Class Diagram?
-Class diagram is the diagram to visualize all of the classes for the system
-A class in the class diagram can be a represent of a person or a real world object
-The number of class in the class diagram can be same the number of entity in the ERD
-The attribute of a class can be same as the attribute of an entity

2.Element of Class Diagram
2.1 Class
-A Class is represent as a rectangle with 3 different parts as: Class name, attributes, and methods
-The + is for public variable or method
-The – is for private variable or method
2.2 Interface / Abstract Class
-If it is an abstract class or an interface, there is a <> or <<>interface> above the class or interface namme

3.1 Participation(or Association) and Carnality
-If two classes has relationship, we connect them by a line called participant or association
-Then, give them the 1:M or M:1 Carnality. We can use the Crow Foot notation.
-Then, on the line, we give the relationship meaning words as has a, give a
3.2 Generalization / Specification
-Generalization can be understood as a relation of a father class to children classes. It is the extends in the OOP.
-IF we read from the father class to children classes, it is specification. It we read from children classes to father class, it is generalization
3.3 Composition / Aggregation
-Aggregation: means a child class can be existed without parent class. It is denote as the blank diamond at the parent class.
-Composition: means a child class can NOT be existed without parent class. It is denote as the BOLD diamond at the parent class.
-This aggregation and composition can be used alone or used with the two relationship 3.1 and 3.2

4.Step to draw a Class Diagram
-List all the class name
-Full fill the class with variable or method. The variable must come with data type.
-Note that the variable and method for a class, we just focus on the attributes for the class object and what are functions that this object can do?
-Use the 3.1 Association relationship
-Use the 3.2 and 3.3 relationship

App A: Note

App B: Sample

Add Comment