UML Differences
UML Differences
UML Differences
Behavioral Diagrams
UML’s five behavioral diagrams are used to visualize, specify, construct, and document the dynamic aspects of a
system. It shows how the system behaves and interacts with itself and other entities (users, other systems). They show
how data moves through the system, how objects communicate with each other, how the passage of time affects the
system, or what events cause the system to change internal states. Since behavior diagrams illustrate the behavior of a
system, they are used extensively to describe the functionality of software systems. As an example, the activity
diagram describes the business and operational step-by-step activities of the components in a system.
In other words, a behavioral diagram shows how the system works ‘in motion’, that is how the system interacts with
external entities and users, how it responds to input or event and what constraints it operates under. There are seven
behavioral diagrams that you can model the dynamics of a system as listed in the Table below:
Behavioral Diagram Brief Description
It is a graphical representations of workflows of stepwise activities and
Activity Diagram
actions with support for choice, iteration and concurrency
It describes a system’s functional requirements in terms of use cases
Use Case Diagram that enable you to relate what you need from a system to how the
system delivers on those needs.
It shows the discrete behavior of a part of a designed system through
State Machine Diagram
finite state transitions.
It shows the sequence of messages exchanged between the objects
Sequence Diagram
needed to carry out the functionality of the scenario.
It shows interactions between objects and/or parts (represented as
Communication Diagram
lifelines) using sequenced messages in a free-form arrangement.
Interaction Overview It depicts a control flow with nodes that can contain other interaction
Diagram diagrams.
It shows interactions when the primary purpose of the diagram is to
Timing Diagram reason about time by focusing on conditions changing within and
among lifelines along a linear time axis.
Structural Diagrams
Structure diagrams depict the static structure of the elements in your system. i.e., how one object relates to another. It
shows the things in the system – classes, objects, packages or modules, physical nodes, components, and interfaces.
For example, just as the static aspects of a house encompass the existence and placement of such things as walls,
doors, windows, pipes, wires, and vents. The Seven UML structural diagrams are roughly organized around the major
groups of things you’ll find when modeling a system.
Since structure diagrams represent the structure, they are used extensively in documenting the software architecture
of software systems.
For example, the component diagram describes how a software system is split up into components and shows the
dependencies among these components.
Structural Diagram Brief Description
Composite Structure It shows the internal structure of a classifier, classifier interactions with the
Diagram environment through ports, or behavior of a collaboration.
It shows a set of nodes and their relationships that illustrates the static
Deployment Diagram
deployment view of an architecture.
It groups related UML elements into a collection of logically related UML
Package Diagram
structure.
Profile Diagram
A UML abstract class is a class without any instances. It represents a common class for other
derived subclasses. An abstract class can contain abstract and also non-abstract attributes and
operations. A class that is not abstract cannot have any abstract fields (attributes, operations).
E.g. a class for Shape can be marked as abstract. It cannot be instantiated because we do not know
what kind of shape it represents. It is a base (super) class for other shape classes (e.g. Ellipse,
Rectangle)
Actor initiates, shuts and even provides input to the system but does not sit inside the software system to perform any
task of the System. System works independently of actor.
Objects can simulate real world actors but still depend upon human actors for start-up, exit and input directly or
indirectly.
Component Diagram
When modeling large object-oriented systems, it is necessary to break down the system into manageable
subsystems. UML component diagrams are used for modeling large systems into smaller subsystems which
can be easily managed.
A component is a replaceable and executable piece of a system whose implementation details are hidden. A
component provides the set of interfaces that a component realizes or implements. Components also require
interfaces to carry out a function.
So, component diagrams are used for,
Component Diagram
Component
A component is a logical unit block of the system, a slightly higher abstraction than classes. It is represented as a rectang le with a smaller
rectangle in the upper right corner with tabs or the word written above the name of the component to help distinguish it from a class.
Interface
An interface (small circle or semi-circle on a stick) describes a group of operations used (required) or created (provided) by components. A
full circle represents an interface created or provided by the component. A semi-circle represents a required interface, like a person's input.
Dependencies
Port
Ports are represented using a square along the edge of the system or a component. A port is often used to help expose required and
provided interfaces of a component.
Deployment diagram
Deployment diagrams are used to visualize the topology of the physical components of a system, where the software components are
deployed.
Deployment diagrams are used to describe the static deployment view of a system. Deployment diagrams consist of nodes and their
relationships
Purpose of Deployment Diagrams
Statechart diagrams are used to capture the changes in various entities of the system from start to end. They are used to
analyze how an event can trigger change within multiple states of a system.
The purpose of these UML diagrams is to represent states of a system. States plays a vital role in state
transition diagrams. All the essential object, states, and the events that cause changes within the states must be
analyzed first before implementing the diagram.
Main Differences
Statechart diagram is used to capture the dynamic aspect of a system.
State machine diagrams are used to represent the behavior of an application. An object goes through various states
during its lifespan.
Statechart diagrams are used to design interactive systems that respond to either internal or external event. Statechart
diagram in UML visualizes the flow of execution from one state to another state of an object.
The primary purpose of a statechart diagram is to model interactive systems and define each and every state of an
object. Statechart diagrams are designed to capture the dynamic behavior of an application system. These diagrams are
used to represent various states of a system and entities within the system.
Events
An event is the specification of a significant occurrence that has a location in time and space.
Anything that happens is modeled as an event in UML.
In the context of state machines, an event is an occurrence of a stimulus that can trigger a state transition
four kinds of events – signals, calls, the passing of time, and a change in state.
Events may be external or internal and asynchronous or synchronous.
Asynchronous events are events that can happen at arbitrary times eg:- signal, the passing of time, and a
change of state.
Synchronous events, represents the invocation of an operation eg:- Calls
External events are those that pass between the system and its actors.
Internal events are those that pass among the objects that live inside the system
Signal
A signal is a named object that is sent asynchronously by one object and then received by another. Exceptions are the
famous examples for signals. A signal may be sent as the action of a state in a state machine or as a message in an
interaction. The execution of an operation can also send signals.
In UML, we model the relationship between an operation and the events using a dependency stereotyped with “send”,
which indicates that an operation sends a particular signal.
Example-
1. Scenario-
Consider a university that requires an application for an online exam. The scenario describes the use of an
online exam, an individual such as a student, and the equipment such as a system.
The scenario for this application is-
Authentication of the student
The URL for the student which is an exam URL
List of options in the exam for the student.
List of questions for the students.
Log-off information of the student.
2. Use cases-
Consider the online exam system. The use case is the online exam. The actor is a student and the system is
server.
The flow of the events-
Entry condition-
The system verifies the student login information
Exit condition-
Successful log off the system
Objects in UML
UML preserves a similar distinction between classes and objects, and they are represented in the same way;
UML classes contain broad descriptions, and UML objects contain specific values that represent instances of
those descriptions. Formally speaking, therefore, an "active object" in UML is any instance of an "active
class," and similarly a "passive object" is an instance of a "passive class"—in a theoretical sense, you could
consider these terms to be essentially interchangeable.
Active Objects
In UML, active classes, and therefore active objects, exist in their own thread of operations and have their
own address space. If execution, or code activity, is thought of in terms of flow, active objects can start or
control that flow. Active objects, in other words, are sequential and do something: modify variables, change
program behavior, and so on. In UML, active classes and objects are distinguished by having a thicker border
than passive objects.
Passive Objects
Passive objects in UML do not generally have the ability to modify or begin the flow of execution, because
they must wait for another object to call them. Instead, passive objects are generally used to store information,
and in many cases this information may be shared between multiple other objects. This may allow passive
objects to be accessed concurrently, not sequentially. To make sure that the data contained inside has a high
integrity, UML allows for passive objects to insist that they be accessed sequentially; if two threads attempt to
call the same sequential passive object, that object can delay the second thread until the first has finished with
it.