The three major building blocks of UML are:
1.
The Elements of the model
2.
The Associations between the elements of the model
3.
The UML Diagrams
The basic elements of an UML model are the classes, the
interfaces and the components. A class may be defined as a self contained unit
that encapsulates a collection of data and methods that operate on the data
resulting on an isolation of the contents of this encapsulated from any
external interface. An interface is a contract which can be used to define a
protocol of behavior. It can be implemented by any class anywhere in the class
hierarchy.
UML Relationships
Let us now understand how we can depict relationships
between various elements in the UML model of a system. Basically, there are
four types of relationships that we use in a UML model of a system. These are
as follows.
·
Association
·
Aggregation
·
Generalization or Inheritance
·
Realization
·
Dependency
UML Diagrams
You have in UML various models that define the notation and
semantics for a wide variety of domains. The UML models depict how the classes
and objects in a system interact with one another. "UML models are
diagrams of three primary types: structural, behavioral, and interaction.
Generally, structural diagrams define the underlying software system (the
code), behavioral diagrams describe what happens in the system under certain
conditions, and interaction diagrams explain control flow." UML diagrams
are used to provide a graphical representation of the system being modeled. UML
2.0 defines thirteen diagrams that are broadly classified into three categories
with each category containing one or more diagrams that fall under that
category. These categories are:
·
The Structural Diagrams
·
The Behavioral Diagrams
·
The Interaction Diagrams
The next section discusses these categories and shows the
UML diagrams that comprise each of these categories.
The Structural Diagrams
These relate to the static structure of a system, i.e., they
represent elements that are static in nature. These diagrams are fundamental to
the UML modeling of a system and portray the static structure of the system as
a whole. The Structural Diagrams are comprised of the following.
·
The Class diagram
·
The Component diagram
·
The Composite Structure diagram
·
The Deployment diagram
·
The Object diagram
·
The Package diagram
The Behavioral Diagrams
The Behavioral Diagrams model how the system functions. The
following are examples of Behavioral Diagrams.
·
Use Case Diagram
·
Activity Diagram
·
State Machine Diagram
The Interaction Diagrams
These diagrams represent how flow of data and control takes
place in the system that is being modeled. They are a subset of the Behavioral
Diagrams. The examples in this category are:
·
Communication Diagram
·
Sequence Diagram
·
UML Timing Diagram
·
Interaction Overview Diagram
We will learn what each of these diagrams and model systems are
in the forthcoming articles in this series. The next section discusses UML
Rules.
UML Rules
The UML also defines a set of rules that can be used to
check whether the UML is properly being followed. "A well formed model is
one that is semantically self-consistent and in harmony with all its related
models."
In UML, you have semantic rules for the following:
·
Names
·
Scope
·
Visibility
·
Integrity
·
Execution