1 Class Diagrams and Entity Relationship Diagrams (ERD)
Class diagrams and ERDs both model the structure of a system. Class diagrams represent the dynamic aspects of a system: both the structural and behavioural features.
ERDs, depicting only structural features provide a static view of the system.
2 Class Diagrams
2.1 Elements of a class diagram:
2.1.1 class
A class is a general concept (represented as a square box).
A class defines the structural attributes and behavioural characteristics of that concept. Shown as a rectangle labeled with the class name.
Class Name
2.1.2 association
Class 1
Class 2
A (semantic) relationship between classes.
A line that joins two classes.
Food
Simple association between two classes. A solid triangle with the association name indicates the direction in which the association is meant to be read.
Class 2
Association
n-ary Association expresses an association between multiple classes
Member
“has-a” relationship
2.1.2.1 binary
Person
Eats
2.1.2.2 n-ary
Class 1 n-ary Class 3
2.1.2.3 Aggregation
Team
page 1 of 14
Tutorial Week 7 - Class and Entity-Relationship Diagrams
2.1.2.4 Composition
Car
“is-composed-of” relationship
Engine
2.1.2.5 Generalization
Car
“is-a-kind-of” relationship
Volvo
2.1.2.6 Dependency
The source class depends on (uses) the target class. (not used for requirements analysis) Project
Project Manager
Team
2.1.2.7 Realization
Class supports all operations of target class but not all attributes or associations.
(not used for requirements analysis)
«datatype»
Human Resources
«datatype»
Project Manager
Worker
«datatype»
System Administrator
page 2 of 14
Tutorial Week 7 - Class and Entity-Relationship Diagrams
2.1.2.8 Association Classes
Can be applied to binary or n-ary associations. Used to capture the attributes of an