Professional Documents
Culture Documents
1. Class Name
2. Attributes
3. Operations
Class Name
The name of the class is only needed in the graphical representation of the
class. It appears in the topmost compartment. A class is the blueprint of an
object which can share the same relationships, attributes, operations, &
semantics. The class is rendered as a rectangle, including its name,
attributes, and operations in sperate compartments.
Attributes:
An attribute is named property of a class which describes the object being
modeled. In the class diagram, this component is placed just below the name-
compartment.
Attributes characteristics
The attributes are generally written along with the visibility factor.
Public, private, protected and package are the four visibilities which are
denoted by +, -, #, or ~ signs respectively.
Visibility describes the accessibility of an attribute of a class.
Attributes must have a meaningful name that describes the use of it in a
class.
Relationships
There are mainly three kinds of relationships in UML:
1. Dependencies
2. Generalizations
3. Associations
Dependency
Generalization:
A generalization helps to connect a subclass to its superclass. A sub-class is
inherited from its superclass. Generalization relationship can’t be used to
model interface implementation. Class diagram allows inheriting from multiple
superclasses.
Association:
In this example, the relationship between student and college is shown which
is studies.
Multiplicity
Let’s say that that there are 100 students in one college. The college can have
multiple students.
Aggregation
Composition:
Abstract Classes
It is a class with an operation prototype, but not the implementation. It is also
possible to have an abstract class with no operations declared inside of it. An
abstract is useful for identifying the functionalities across the classes. Let us
consider an example of an abstract class. Suppose we have an abstract class
called as a motion with a method or an operation declared inside of it. The
method declared inside the abstract class is called a move ().
This abstract class method can be used by any object such as a car, an
animal, robot, etc. for changing the current position. It is efficient to use this
abstract class method with an object because no implementation is provided
for the given function. We can use it in any way for multiple objects.
In UML, the abstract class has the same notation as that of the class. The
only difference between a class and an abstract class is that the class name is
strictly written in an italic font.
Here, are some points which should be kept in mind while drawing a class
diagram:
1. Objects: The representation of an object is done by an object symbol with its name and
class underlined, separated by a colon.
In the collaboration diagram, objects are utilized in the following ways:
o The object is represented by specifying their name and class.
o It is not mandatory for every class to appear.
o A class may constitute more than one object.
o In the collaboration diagram, firstly, the object is created, and then its class is
specified.
o To differentiate one object from another object, it is necessary to name them.
2. Actors: In the collaboration diagram, the actor plays the main role as it invokes the
interaction. Each actor has its respective role and name. In this, one actor initiates the use
case.
3. Links: The link is an instance of association, which associates the objects and actors. It
portrays a relationship between the objects through which the messages are sent. It is
represented by a solid line. The link helps an object to connect with or navigate to
another object, such that the message flows are attached to links.
4. Messages: It is a communication between objects which carries information and includes
a sequence number, so that the activity may take place. It is represented by a labeled
arrow, which is placed near a link. The messages are sent from the sender to the receiver,
and the direction must be navigable in that particular direction. The receiver must
understand the message.
When to use a Collaboration Diagram?
The collaborations are used when it is essential to depict the relationship between the
object. Both the sequence and collaboration diagrams represent the same information,
but the way of portraying it quite different. The collaboration diagrams are best suited
for analyzing use cases.
Following are some of the use cases enlisted below for which the collaboration diagram
is implemented:
10 Sec
1. To model collaboration among the objects or roles that carry the functionalities of use
cases and operations.
2. To model the mechanism inside the architectural design of the system.
3. To capture the interactions that represent the flow of messages between the objects and
the roles inside the collaboration.
4. To model different scenarios within the use case or operation, involving a collaboration
of several objects and interactions.
5. To support the identification of objects participating in the use case.
6. In the collaboration diagram, each message constitutes a sequence number, such that
the top-level message is marked as one and so on. The messages sent during the same
call are denoted with the same decimal prefix, but with different suffixes of 1, 2, etc. as
per their occurrence.
Types of State
The UML consist of three states:
The primary focus of the state machine diagram is to depict the states of a system.
These states are essential while drawing a state transition diagram. The objects, states,
and events due to which the state transition occurs must be acknowledged before the
implementation of a state machine diagram.
Following are the steps that are to be incorporated while drawing a state machine
diagram:
It portrays the changes underwent by an object from the start to the end. It basically
envisions how triggering an event can cause a change within the system.
Initially, the ATM is turned off. After the power supply is turned on, the ATM starts
performing the startup action and enters into the Self Test state. If the test fails, the
ATM will enter into the Out Of Service state, or it will undergo a triggerless
transition to the Idle state. This is the state where the customer waits for the
interaction.
Whenever the customer inserts the bank or credit card in the ATM's card reader, the
ATM state changes from Idle to Serving Customer, the entry action readCard is
performed after entering into Serving Customer state. Since the customer can cancel
the transaction at any instant, so the transition from Serving Customer state back to
the Idle state could be triggered by cancel event.
Here the Serving Customer is a composite state with sequential substates that
are Customer Authentication, Selecting Transaction, and Transaction.