UML Object Diagrams and Activity Diagrams
UML Object Diagrams and Activity Diagrams
Object diagrams are derived from class diagrams so object diagrams are dependent upon class
diagrams.
Object diagrams represent an instance of a class diagram. The basic concepts are similar for class
diagrams and object diagrams. Object diagrams also represent the static view of a system but this
static view is a snapshot of the system at a particular moment.
Object diagrams are used to render a set of objects and their relationships as an instance.
The difference is that a class diagram represents an abstract model consisting of classes and their
relationships. However, an object diagram represents an instance at a particular moment, which
is concrete in nature.
It means the object diagram is closer to the actual system behavior. The purpose is to capture the
static view of a system at a particular moment.
So both diagrams are made of same basic elements but in different form. In class diagram
elements are in abstract form to represent the blue print and in object diagram the elements are in
concrete form to represent the real world object.
To capture a particular system, numbers of class diagrams are limited. However, if we consider
object diagrams then we can have unlimited number of instances, which are unique in nature.
Only those instances are considered, which have an impact on the system.
The difference is that a class diagram represents an abstract model consisting of classes and their
relationships. However, an object diagram represents an instance at a particular moment, which
is concrete in nature.
It means the object diagram is closer to the actual system behavior. The purpose is to capture the
static view of a system at a particular moment.
So both diagrams are made of same basic elements but in different form. In class diagram
elements are in abstract form to represent the blue print and in object diagram the elements are in
concrete form to represent the real world object.
To capture a particular system, numbers of class diagrams are limited. However, if we consider
object diagrams then we can have unlimited number of instances, which are unique in nature.
Only those instances are considered, which have an impact on the system.
The same is true for special order and normal order objects which have number of orders as 20,
30, and 60. If a different time of purchase is considered, then these values will change
accordingly.
The following object diagram has been drawn considering all the points mentioned above
UML - Activity Diagram
Activity Diagrams
In UML, an activity diagram is used to display the sequence of activities. Activity diagrams
show the workflow from a start point to the finish point detailing the many decision paths that
exist in the progression of events contained in the activity. They may be used to detail situations
where parallel processing may occur in the execution of some activities. Activity diagrams are
useful for business modelling where they are used for detailing the processes involved in
business activities.
The following sections describe the elements that constitute an activity diagram.
Activities
An action represents a single step within an activity. Actions are denoted by round-cornered
rectangles.
Action Constraints
Constraints can be attached to an action. The following diagram shows an action with local pre-
and post-conditions.
Control Flow
A control flow shows the flow of control from one action to the next. Its notation is a line with
an arrowhead.
Initial Node
Final Node
There are two types of final node: activity and flow final nodes. The activity final node is
depicted as a circle with a dot inside.
The difference between the two node types is that the flow final node denotes the end of a single
control flow; the activity final node denotes the end of all control flows within the activity.
Objects and Object Flows
An object flow is a path along which objects or data can pass. An object is shown as a rectangle.
An object flow is shown as a connector with an arrowhead denoting the direction the object is
being passed.
An object flow must have an object on at least one of its ends. A shorthand notation for the
above diagram would be to use input and output pins.
Decision nodes and merge nodes have the same notation: a diamond shape. They can both be
named. The control flows coming away from a decision node will have guard conditions which
will allow control to flow if the guard condition is met. The following diagram shows use of a
decision node and a merge node.
Forks and joins have the same notation: either a horizontal or vertical bar (the orientation is
dependent on whether the control flow is running left to right or top to bottom). They indicate the
start and end of concurrent threads of control. The following diagram shows an example of their
use.
A join is different from a merge in that the join synchronizes two inflows and produces a single
outflow. The outflow from a join cannot execute until all inflows have been received. A merge
passes any control flows straight through it. If two or more inflows are received by a merge
symbol, the action pointed to by its outflow is executed two or more times.
Expansion Region
An expansion region is a structured activity region that executes multiple times. Input and output
expansion nodes are drawn as a group of three boxes representing a multiple selection of items.
The keyword "iterative", "parallel" or "stream" is shown in the top left corner of the region.
Exception Handlers
An interruptible activity region surrounds a group of actions that can be interrupted. In the very
simple example below, the "Process Order" action will execute until completion, when it will
pass control to the "Close Order" action, unless a "Cancel Request" interrupt is received, which
will pass control to the "Cancel Order" action.
Partition
Statechart diagrams are very important for describing the states. States can be identified as the
condition of objects when a particular event occurs.
Before drawing a Statechart diagram we should clarify the following points −
Following is an example of a Statechart diagram where the state of Order object is analyzed
The first state is an idle state from where the process starts. The next states are arrived for events
like send request, confirm request, and dispatch order. These events are responsible for the state
changes of order object.
During the life cycle of an object (here order object) it goes through the following states and
there may be some abnormal exits. This abnormal exit may occur due to some problem in the
system. When the entire life cycle is complete, it is considered as a complete transaction as
shown in the following figure. The initial and final state of an object is also shown in the
following figure.
Symbol
Symbol Image Description
Name
Packages can also be used within other UML model types to organize and arrange elements such
as classes, data entities, and use cases. By fuzing the package diagram structure with other UML
diagrams, you can simplify any model type, making it easier to understand.
Use the following arrows and message symbols to show how information is transmitted between
objects. These symbols may reflect the start and execution of an operation or the sending and
reception of a signal.
An ATM allows patrons to access their bank accounts through a completely automated process.
You can examine the steps of this process in a manageable way by drawing or viewing a
sequence diagram. The example below outlines the sequential order of the interactions in the
ATM system.