Submitted by: Submitted by ahmed117672
Views: 10
Words: 608
Pages: 3
Category: English Composition
Date Submitted: 03/14/2016 10:50 AM
Software Engineering I
Class Diagram
Elements of the Class Diagram
1. Class
•
The class is the basic component of the class diagram where each class has a class
name, a set of attributes (optional), and a set of methods (optional). Also the scope
of the attributes and methods should be shown for each class (Private, Package,
Protected, Public).
class System
Employee
-
id: int
name: char
+ getID() : int
+ getName() : char
+ setID(int) : void
+ setName(char) : void
1
2. Association Relationship:
•
The association relationship describes a relationship between two classes where one
class can use another class in some way (or it can be a reflexive relationship for one
class) where both classes have their own life cycles and are independent of each
other. Also note that the multiplicity properties of the classes must be specified and
that it must be indicated whether it is a bidirectional (having zero or two
arrowheads) or unidirectional relationship (having one arrow head). This type of
relationship can optionally be assigned a meaningful name to describe how the two
classes are associated.
•
Association Class:
An association class is used whenever there is a need for an association relationship
to have attributes and methods that are part of the relationship between the two
associated classes.
class System
Professor
Course
Teaches
1
1..*
3. Aggregation Relationship:
•
The aggregation relationship describes a relationship between two classes where one
class is said to belong to another class. This type of relationship is said to be a “HASA” relationship where the owner class owns the owned class but the life time of the
owned class is independent of the owner class.
class System
MusicPlayer
Car
1
1
2
4. Composition Relationship:
•
The composition relationship describes a relationship between two classes where
one class is said to belong to another class. This type of relationship is said to be a
“WHOLE-PART” relationship where the owner class owns...