Software Engineering: Experiment No-7
Software Engineering: Experiment No-7
1. Objective (s):
After completing this experiment, student will be able to:
Graphically represent a class, and associations among different classes
Identify the logical sequence of activities undergoing in a system, and
represent them pictorially
2. Theory:
Structural and Behavioral aspects
Class diagram
Class diagram contains the system classes with its data members, operations and
relationships between classes.
Class
Example
Figure - 1
Example
Figure - 2
Geometric_Shapes is the class that describes how many sides a particular shape
has. Triangle, Quadrilateral and Pentagon are the classes that inherit the property
of the Geometric_Shapes class. So the relations among these classes are
generalization. Now Equilateral_Triangle, Isosceles_Triangle and
Scalene_Triangle, all these three classes inherit the properties of Triangle class as
each one of them has three sides. So, these are specialization of Triangle class.
Relationships
Example
Figure - 3
Example
For a supermarket in a city, each branch runs some of the departments they have.
So, the relation among the classes ‘Branch’ and ‘Department’ can be designed as
an aggregation. In UML, it can be shown as in the fig. below
Figure - 4
-Composition
Example
Let consider a shopping mall has several branches in different locations in a city.
The existence of branches completely depends on the shopping mall as if it is not
exist any branch of it will no longer exists in the city. This relation can be
described as composition and can be shown as below
Figure - 5
-**Multiplicity **
It describes how many numbers of instances of one class is related to the number
of instances of another class in an association.
Instance Multiplicity
Single instance 1
Zero or one instance 0..1
Zero or more instance 0..*
One or more instance 1..*
Particular range (two to six) 2..6
Example
Figure - 6
Sequence diagram
Sequence diagram contains the objects of a system and their life-line bar and the
messages passing between them.
Object
Objects which are created at the time of execution of use case and are involved in
message passing , are appear in diagram, at the point of their creation.
Life-line bar
A down-ward vertical line from object-box is shown as the life-line of the object.
A rectangle bar on life-line indicates that it is active at that point of time.
Messages
Messages are shown as an arrow from the life-line of sender object to the life-line
of receiver object and labeled with the message name. Chronological order of the
messages passing throughout the objects’ life-line show the sequence in which
they occur. There may exist some different types of messages :
Figure - 7
3. Outcome of Study:
Department of Information Technology
Medi-Caps University
6
IT3CO36: Software Engineering Experiment no- 7
Experiment Title: Modeling UML Class Diagrams and Sequence Page 7 of 7
diagrams
4. Output: