Practical 8
Practical 8
Title:
Draw Class diagram, sequence diagram, collaboration diagram, state transition diagram, for the
assigned project.
Theory:
● Class diagram:
In software engineering a Class diagram in the UML(Unified Modelling Language) is a type
of static structure diagram that describes the structure of a system by showing the system classes, their
attributes, operations(or methods) and the relationships among objects.
Class attributes Attributes are shown in the second partition. They map on to member
variables in code
Class methods Methods are shown in the third partition. They are services the class
provides
Relationships
Existing relationships in a system describe legitimate connections between the classes in that system.
● Association
It is an instance level relationship that allows exchanging messages among the objects of both ends of
association. A simple straight line connecting two class boxes represent an association. We can give a
name to association and also at the both end we may indicate role names and multiplicity of the adjacent
classes. Association may be uni-directional.
Example:
In structure model for a system of an organization an employee (instance of ‘Employee’ class) is always
assigned to a particular department (instance of ‘Department’ class) and the association can be shown
by a line connecting the respective classes.
● Aggregation
It is a special form of association which describes a part-whole relationship between a pair of classes.
It means, in a relationship, when a class holds some instances of related class, then that relationship can
be designed as an aggregation.
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
● Composition:
It is a strong from of aggregation which describes that whole is completely owns its part. Life
cycle of the part depends on the whole.
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
Multiplicity:
It describes how many numbers of instances of one class is related to the number of instances of
another class in an association.
Example:
One vehicle may have two or more wheels.
● Sequence diagram:
Sequence diagram simply depicts interaction between objects in a sequential order. Sequence
diagram describe how and in what order the objects in a system functions. These diagrams are widely
used by businessman and software developers to document and understand requirements for new and
existing systems.
Name Symbol
Actor
Lifelines
Message:
A message can flow in any
direction; from left to right,
right to left or back to the
Message Caller itself.
1)a Synchronous message is
used when the sender waits for
the receiver to process the
message and return before
carrying on with another
message. The arrowhead used
to indicate this type of message
is a solid one.
2)An Asynchronous message
is used when the message caller
does not wait for the receiver to
process the message and return
before sending other messages
to other objects within the
system. The arrowhead used to
show this type of message is a
line arrow like shown in the
example below
3) Participant destruction
message:
participants when no longer
needed can also be deleted
from a sequence diagram. This
is done by adding an ‘X’ at the
end of the lifeline of the said
participant.
4)Reflexive message
Comment
Sr no Name Icon
1 Object
ObjectName : Class Name
3 Association Role
5 Link to self
ObjectName : Class Name
6 Message
ObjectName : Class Name
message
7 Note
● State transition diagram:
The state transition diagram is one method for representing the behaviour of a system
By depicting its states and the events that cause the system to change state. In addition, the state
diagram indicates actions taken as a consequence of a particular event.
State transition diagram notations:
Sr no Name Symbol
1 State
2 Start/initial state
3 Final/end state
4 Transition
5 Decision
Conclusion:
Thus, we have successfully drawn class diagram , sequence diagram, collaboration diagram and state
transition diagram for give project.