UML Introduction
UML Introduction
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:
UML-Building Blocks
o Structural things
o Behavioral things
o Grouping things
o Annotational things
Structural things
Nouns that depicts the static behavior of a model is termed as structural
things. They display the physical and conceptual components. They include
class, object, interface, node, collaboration, component, and a use case.
Class: A Class is a set of identical things that outlines the functionality and
properties of an object. It also represents the abstract class whose
functionalities are not defined. Its notation is as follows;
Class Visibility
Actor: It comes under the use case diagrams. It is an object that interacts
with the system, for example, a user.
Behavioral Things
They are the verbs that encompass the dynamic parts of a model. It depicts
the behavior of a system. They involve state machine, activity diagram,
interaction diagram, grouping things, annotation things
Grouping Things
It is a method that together binds the elements of the UML model. In UML,
the package is the only thing, which is used for grouping.
Package: Package is the only thing that is available for grouping behavioral
and structural things.
Annotation Things
It is a mechanism that captures the remarks, descriptions, and comments of
UML model elements. In UML, a note is the only Annotational thing.
Association: A set of links that associates the entities to the UML model. It
tells how many elements are actually taking part in forming that relationship.
UML diagrams are classified into three categories that are given below:
1. Structural Diagram
2. Behavioral Diagram
3. Interaction Diagram
o Class diagram
o Object diagram
o Package diagram
o Component diagram
o Deployment diagram
o Activity diagram
o State machine diagram
o Use case diagram
o Timing diagram
o Sequence diagram
o Collaboration diagram
UML- Architecture
Software architecture provides a basic design of a complete software system. It
defines the elements included in the system, the functions each element has, and
how each element relates to one another. In short, it is a big picture or overall
structure of the whole system, how everything works together.
Design View
o It is a view that shows how the functionality is designed inside the system in
terms of static structure and dynamic behavior.
o It captures the vocabulary of the problem space and solution space.
o With UML, it represents the static aspects of this view in class and object
diagrams, whereas its dynamic aspects are captured in interaction diagrams,
state chart diagrams, and activity diagrams.
Implementation View
o It is the view that represents the organization of the core components and
files.
o It primarily addresses the configuration management of the system?s
releases.
o With UML, its static aspects are expressed in component diagrams, and the
dynamic aspects are captured in interaction diagrams, state chart diagrams,
and activity diagrams.
Process View
o It is the view that demonstrates the concurrency of the system.
o It incorporates the threads and processes that make concurrent system and
synchronized mechanisms.
o It primarily addresses the system's scalability, throughput, and performance.
o Its static and dynamic aspects are expressed the same way as the design
view but focus more on the active classes that represent these threads and
processes.
Deployment View
o It is the view that shows the deployment of the system in terms of physical
architecture.
o It includes the nodes, which form the system hardware topology where the
system will be executed.
o It primarily addresses the distribution, delivery, and installation of the parts
that build the physical system.
1. Structural Diagrams
Structural diagrams depict a static view or structure of a system. It is widely
used in the documentation of software architecture. It embraces class
diagrams, composite structure diagrams, component diagrams, deployment
diagrams, object diagrams, and package diagrams. It presents an outline for
the system. It stresses the elements to be present that are to be modeled.
o Class Diagram: Class diagrams are one of the most widely used
diagrams. It is the backbone of all the object-oriented software
systems. It depicts the static structure of the system. It displays the
system's class, attributes, and methods. It is helpful in recognizing the
relation between different objects as well as classes.
o Composite Structure Diagram: The composite structure diagrams
show parts within the class. It displays the relationship between the
parts and their configuration that ascertain the behavior of the class. It
makes full use of ports, parts, and connectors to portray the internal
structure of a structured classifier. It is similar to class diagrams, just
the fact it represents individual parts in a detailed manner when
compared with class diagrams.
o Object Diagram: It describes the static structure of a system at a
particular point in time. It can be used to test the accuracy of class
diagrams. It represents distinct instances of classes and the
relationship between them at a time.
o Component Diagram: It portrays the organization of the physical
components within the system. It is used for modeling execution
details. It determines whether the desired functional requirements
have been considered by the planned development or not, as it depicts
the structural relationships between the elements of a software
system.
o Deployment Diagram: It presents the system's software and its
hardware by telling what the existing physical components are and
what software components are running on them. It produces
information about system software. It is incorporated whenever
software is used, distributed, or deployed across multiple machines
with dissimilar configurations.
o Package Diagram: It is used to illustrate how the packages and their
elements are organized. It shows the dependencies between distinct
packages. It manages UML diagrams by making it easily
understandable. It is used for organizing the class and use case
diagrams.
2. Behavioral Diagrams:
Behavioral diagrams portray a dynamic view of a system or the behavior of a
system, which describes the functioning of the system. It includes use case
diagrams, state diagrams, and activity diagrams. It defines the interaction
within the system.
o State Machine Diagram: It is a behavioral diagram. it portrays the
system's behavior utilizing finite state transitions. It is also known as
the State-charts diagram. It models the dynamic behavior of a class
in response to external stimuli.
o Activity Diagram: It models the flow of control from one activity to
the other. With the help of an activity diagram, we can model
sequential and concurrent activities. It visually depicts the workflow as
well as what causes an event to occur.
o Use Case Diagram: It represents the functionality of a system by
utilizing actors and use cases. It encapsulates the functional
requirement of a system and its association with actors. It portrays the
use case view of a system.
3. Interaction Diagrams
Interaction diagrams are a subclass of behavioral diagrams that give
emphasis to object interactions and also depicts the flow between various
use case elements of a system. In simple words, it shows how objects
interact with each other and how the data flows within them. It consists of
communication, interaction overview, sequence, and timing diagrams.
Cardinality
Dependency
Whenever there is a change in either the structure or the behavior of the
class that affects the other class, such a relationship is termed as a
dependency. Or, simply, we can say a class contained in other class is known
as dependency. It is a unidirectional relationship.
Association
Association is a structural relationship that represents how two entities are
linked or connected to each other within a system. It can form several types
of associations, such as one-to-one, one-to-many, many-to-
one, and many-to-many. A ternary association is one that constitutes three
links. It portrays the static relationship between the entities of two classes.
An association can be categorized into four types of associations, i.e., bi-
directional, unidirectional, aggregation (composition aggregation), and
reflexive, such that an aggregation is a special form of association and
composition is a special form of aggregation. The mostly used associations
are unidirectional and bi-directional.
Composition
In a composition relationship, the child depends on the parent. It forms a
two-way relationship. It is a special case of aggregation. It is known as Part-
of relationship.
Examples A doctor has patients when the A hospital and its wards. If
doctor gets transfer to another the hospital is destroyed, the
hospital, the patients do not wards also get destroyed.
accompany to a new workplace.
Generalization
The generalization relationship implements the object-oriented concept
called inheritance or is-a relationship. It exists between two objects (things
or entities), such that one entity is a parent (superclass or base class), and
the other one is a child (subclass or derived class). These are represented in
terms of inheritance. Any child can access, update, or inherit the
functionality, structure, and behavior of the parent.
Realization
It is a kind of relationship in which one thing specifies the behavior or a
responsibility to be carried out, and the other thing carries out that behavior.
It can be represented on a class diagram or component diagrams. The
realization relationship is constituted between interfaces, classes, packages,
and components to link a client element to the supplier element.