Software engineering unit 3
UNIT
3
What is UML
The UML stands for
Unified modeling language, is a standardized general-purpose visual modeling
language in the field of Software Engineering. It is used for specifying,
visualizing, constructing, and documenting the primary artifacts of the
software system. It helps in designing and characterizing, especially those
software systems that incorporate the concept of Object orientation. It
describes the working of both the software and hardware systems.
Characteristics of
UML
The UML has the
following features:
- It is a generalized modeling
language.
- It is distinct from other
programming languages like C++, Python, etc.
- It is interrelated to
object-oriented analysis and design.
- It is used to visualize the
workflow of the system.
- It is a pictorial language,
used to generate powerful modeling artifacts.
Conceptual Modeling
Before moving
ahead with the concept of UML, we should first understand the basics of the
conceptual model.
A conceptual model
is composed of several interrelated concepts. It makes it easy to understand
the objects and how they interact with each other. This is the first step
before drawing UML diagrams.
Following are some
object-oriented concepts that are needed to begin with UML:
- Object: An object is a real
world entity. There are many objects present within a single system. It is
a fundamental building block of UML.
- Class: A class is a software
blueprint for objects, which means that it defines the variables and
methods common to all the objects of a particular type.
- Abstraction: Abstraction is the
process of portraying the essential characteristics of an object to the
users while hiding the irrelevant information. Basically, it is used to
envision the functioning of an object.
- Inheritance: Inheritance is the
process of deriving a new class from the existing ones.
- Polymorphism: It is a mechanism of
representing objects having multiple forms used for different purposes.
- Encapsulation: It binds the data and
the object together as a single unit, enabling tight coupling between
them.
Design
using UML
As
UML describes the real-time systems, it is very important to make a conceptual
model and then proceed gradually. The conceptual model of UML can be mastered
by learning the following three major elements −
- UML
building blocks
- Rules
to connect the building blocks
- Common
mechanisms of UML
Building
Blocks of UML
This
chapter describes all the UML building blocks. The building blocks of UML can
be defined as –
- Things
- Relationships
- Diagrams
Things
Things are
the most important building blocks of UML. Things can be −
- Structural
- Behavioral
- Grouping
- Annotational
Structural Things
Structural
things define the static part of the model. They
represent the physical and conceptual elements. Following are the brief
descriptions of the structural things.
Class
− Class represents a set of objects having
similar responsibilities.
Interface
− Interface defines a set of operations, which
specify the responsibility of a class.
Collaboration
−Collaboration defines an interaction between
elements.
Use
case −Use case represents a set of actions performed by a
system for a specific goal.
Component
−Component describes the physical part of a system.
Node
− A node can be defined as a physical element
that exists at run time.
Behavioral Things
A
behavioral thing consists of the dynamic parts of UML models.
Following are the behavioral things −
Interaction
− Interaction is defined as a behavior that
consists of a group of messages exchanged among elements to accomplish a
specific task.
State
machine − State machine is useful when the state of an
object in its life cycle is important. It defines the sequence of states an
object goes through in response to events. Events are external factors
responsible for state change
Grouping
Things
Grouping
things can be defined as a mechanism to group
elements of a UML model together. There is only one grouping thing available −
Package
− Package is the only one grouping thing
available for gathering structural and behavioral things.
Annotational
Things
Annotational
things can be defined as a mechanism to capture
remarks, descriptions, and comments of UML model elements. Note -
It is the only one Annotational thing available. A note is used to render
comments, constraints, etc. of an UML element.
Relationship
Relationship is
another most important building block of UML. It shows how the elements are
associated with each other and this association describes the functionality of
an application.
There
are four kinds of relationships available.
Dependency
Dependency
is a relationship between two things in which change in one element also
affects the other.
Association
Association
is basically a set of links that connects the elements of a UML model. It also
describes how many objects are taking part in that relationship.
Generalization
Generalization
can be defined as a relationship which connects a specialized element with a
generalized element. It basically describes the inheritance relationship in the
world of objects.
Realization
Realization
can be defined as a relationship in which two elements are connected. One
element describes some responsibility, which is not implemented and the other
one implements them. This relationship exists in case of interfaces.
UML Diagrams
UML diagrams are the ultimate output of
the entire discussion. All the elements, relationships are used to make a
complete UML diagram and the diagram represents a system.
The
visual effect of the UML diagram is the most important part of the entire
process. All the other elements are used to make it complete.
UML
includes the following nine diagrams, the details of which are described in the
subsequent chapters.
- Class
diagram
- Object
diagram
- Use
case diagram
- Sequence
diagram
- Collaboration
diagram
- Activity
diagram
- State
chart diagram
- Deployment
diagram
- Component
diagram
UML DIAGRAMS
We
prepare UML diagrams to understand the system in a better and simple way. A
single diagram is not enough to cover all the aspects of the system. UML
defines various kinds of diagrams to cover most of the aspects of a system.
You
can also create your own set of diagrams to meet your requirements. Diagrams
are generally made in an incremental and iterative way.
There
are two broad categories of diagrams and they are again divided into
subcategories −
· Structural
Diagrams
· Behavioral
Diagrams
Structural
Diagrams
The
structural diagrams represent the static aspect of the system. These static
aspects represent those parts of a diagram, which forms the main structure and
are therefore stable.
These
static parts are represented by classes, interfaces, objects, components, and
nodes. The four structural diagrams are −
- Class
diagram
- Object
diagram
- Component
diagram
- Deployment
diagram
Class
Diagram
Class
diagrams are the most common diagrams used in UML. Class diagram consists of
classes, interfaces, associations, and collaboration. Class diagrams basically
represent the object-oriented view of a system, which is static in nature.
Active
class is used in a class diagram to represent the concurrency of the system.
Class
diagram represents the object orientation of a system. Hence, it is generally
used for development purpose. This is the most widely used diagram at the time
of system construction.
Object
Diagram
Object
diagrams can be described as an instance of class diagram. Thus, these diagrams
are more close to real-life scenarios where we implement a system.
Object
diagrams are a set of objects and their relationship is just like class
diagrams. They also represent the static view of the system.
The
usage of object diagrams is similar to class diagrams but they are used to
build prototype of a system from a practical perspective.
Component
Diagram
Component
diagrams represent a set of components and their relationships. These
components consist of classes, interfaces, or collaborations. Component
diagrams represent the implementation view of a system.
During
the design phase, software artifacts (classes, interfaces, etc.) of a system
are arranged in different groups depending upon their relationship. Now, these
groups are known as components.
Finally,
it can be said component diagrams are used to visualize the implementation.
Deployment
Diagram
Deployment
diagrams are a set of nodes and their relationships. These nodes are physical
entities where the components are deployed.
Deployment
diagrams are used for visualizing the deployment view of a system. This is
generally used by the deployment team.
Note −
If the above descriptions and usages are observed carefully then it is very
clear that all the diagrams have some relationship with one another. Component
diagrams are dependent upon the classes, interfaces, etc. which are part of
class/object diagram. Again, the deployment diagram is dependent upon the
components, which are used to make component diagrams.
Behavioral
Diagrams
Any
system can have two aspects, static and dynamic. So, a model is considered as
complete when both the aspects are fully covered.
Behavioral
diagrams basically capture the dynamic aspect of a system. Dynamic aspect can
be further described as the changing/moving parts of a system.
UML
has the following five types of behavioral diagrams −
- Use
case diagram
- Sequence
diagram
- Collaboration
diagram
- State
chart diagram
- Activity
diagram
Use
Case Diagram
Use
case diagrams are a set of use cases, actors, and their relationships. They
represent the use case view of a system.
A
use case represents a particular functionality of a system. Hence, use case
diagram is used to describe the relationships among the functionalities and
their internal/external controllers. These controllers are known as actors.
Sequence
Diagram
A
sequence diagram is an interaction diagram. From the name, it is clear that the
diagram deals with some sequences, which are the sequence of messages flowing
from one object to another.
Interaction
among the components of a system is very important from implementation and
execution perspective. Sequence diagram is used to visualize the sequence of
calls in a system to perform a specific functionality.
Collaboration
Diagram
Collaboration
diagram is another form of interaction diagram. It represents the structural
organization of a system and the messages sent/received. Structural
organization consists of objects and links.
The
purpose of collaboration diagram is similar to sequence diagram. However, the
specific purpose of collaboration diagram is to visualize the organization of
objects and their interaction.
State
chart Diagram
Any
real-time system is expected to be reacted by some kind of internal/external
events. These events are responsible for state change of the system.
State
chart diagram is used to represent the event driven state change of a system.
It basically describes the state change of a class, interface, etc.
State
chart diagram is used to visualize the reaction of a system by
internal/external factors.
Activity
Diagram
Activity
diagram describes the flow of control in a system. It consists of activities
and links. The flow can be sequential, concurrent, or branched.
Activities
are nothing but the functions of a system. Numbers of activity diagrams are
prepared to capture the entire flow in a system.
Activity
diagrams are used to visualize the flow of controls in a system. This is
prepared to have an idea of how the system will work when executed.
Note −
Dynamic nature of a system is very difficult to capture. UML has provided
features to capture the dynamics of a system from different angles. Sequence
diagrams and collaboration diagrams are isomorphic, hence they can be converted from one another
without losing any information. This is also true for State chart and activity
diagram.
Comments
Post a Comment