UML Building Blocks

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 31

UML Building Blocks

INTRODUCTION
• UML stands for unified modeling language which revolves around
various blocks to generate a single model.
• Building blocks are the things required to develop one full UML
model diagram.
• It is an essential part of every UML diagram. 
The basic UML building blocks:
• Things
• Relationships
• Diagrams
• Things
• A thing can be described as any real-world entity or an object. Things are
divided into various categories in UML as follows,
• Structural things
• Behavioral things
• Grouping things
• Annotational things
Things

• Four Types
• Structural things -- The nouns of UML models. These represent elements that are
conceptual or physical. There are seven kinds of structural things: Class, Interface,
Collaboration, Use Case, Active Class, Component, and Node.
• Behavioral things -- Dynamic parts of UML models. The verbs which represent
behavior over time and space. There are two kinds of behavioral things:
Interaction, and State Machine. Grouping things -- Organizational parts of UML.
These are boxes into which models can be decomposed. There is only one kind of
grouping thing, the Package.
• Annotational things -- Explanatory parts of UML. Used to describe, illuminate, and
remark any element of a model. There is only one kind of annotational thing, the
Note.
Structural things
• A structural thing is used to describe the static part of a model. It is
used to represent the things that are visible to human eyes.
• Structural things are all about the physical part of a system.
• It is the noun of a UML model, such as a class, object, interface,
collaboration, use case, component, and a node.
• There are seven kinds of structural things:
• Class, Interface, Collaboration,
• Use Case, Active Class, Component,
• and Node.
Class:
• A class is used to represent various
objects.
• It is used to define the properties and
operations of an object.
• In UML, we can also represent an
abstract class.
• A class whose functionalities are not
defined is called an abstract class.
• Any UML class notation is generally
expressed as :
Object:

• An object is an entity which is


used to describe the behavior and
functions of a system.
• The class and object have the
same notations.
• The only difference is that an
object name is always underlined
in UML.
• The notation of any object in UML
is given below.
Deployment diagram:

• It represents the physical hardware on which


system is installed.
• A deployment diagram represents the
physical view of a system.
• It denotes the communication and
interaction between various parts of the
system.
• A deployment diagram consists of the
following notations:
• A node
• A component
• An artifact
• An interface
Behavioral things

• They are the verbs of a UML model,


such as interactions, activities and
state machines. Behavioral things are
used to represent the behavior of a
system.
• Behavioral things consist of:
• State machine:
• It used to describe various states of a
single component throughout the
software development life cycle. It is
used to capture different states of a
system component.
Activity diagram:
• An activity diagram is used to
represent various activities
carried out by different
components of a system.
• It is denoted the same as that of
the state machine diagram.
• Activity diagram mainly contains
initial state, final state, a
decision box, and an action
notation.
Interaction diagram:
• Interaction diagrams are used to
visualize the message flow
between various components of a
system.
• Sequence diagram: A sequence
diagram shows interactions
between one or more lifelines
within real time.
• The notation of a sequence
diagram is given below,
Grouping things

• It is the package which is used to


group semantically related
modeling elements into a single
cohesive unit.
• The package is the only grouping
thing available in the UML.
• Annotational things
• It is like a note, which may be
written to the model to capture
some vital information.
• It is similar to the yellow sticky
note.
Relationships

• The relationship allows you to


show on a model how two or
• Relationships in UML are
more things relate to each other.
categorized as follows,
• The relationship in UML will
enable you to capture meaningful • Association relationship
connections between things. • Dependency relationship
• It shows how each element is • Generalization relationship
associated with each other and • Realization relationship
how this association describes the
functionality of an application.
Association relationship

• It is a set of links that connect elements of • Association relationship is


the UML model.
denoted as follows,
• It also defines how many objects are taking
part in that relation.
• It illustrates how many elements are
participating in a particular interaction.
• It is denoted as a dotted line with
arrowheads on both sides.
• Both the sides contain an element which
describes the relationship.
• A new term multiplicity is introduced that
tells us how many objects of a particular
element are associated.
Dependency relationship

It is denoted by a dotted line with an arrow at one side.


• In this kind of a relationship, the
source element is dependent
upon the target element and
may be affected by changes to it.
It is one of the most important
notations of UML. It defines the
direction of a dependency from
one object to another.
Generalization relationship
• It is also called as a parent-child
relationship. It is a relationship between
a general thing and a more specific kind
of a thing.
• This type of relationship is used to
represent the inheritance concept.

• It is denoted by a straight line with a


hollow arrowhead at one side.

• Generalization relationship is denoted as


follows,
Realization relationship

• In this, one element describes some


responsibility which is not implemented
and the other elements implement the
functionality mentioned by the first
element. Realization relationship is
widely used while denoting interfaces.

• It is denoted as a dotted line with a


hollow arrowhead at one end.

• Realization relationship is denoted as


follows:
Class diagram
• UML CLASS DIAGRAM gives an • Class Diagram defines the types
overview of a software system of objects in the system and the
by displaying classes, attributes, different types of relationships
operations, and their that exist among them.
relationships. • A class can refer to another class.
• This Diagram includes the class A class can have its objects or
name, attributes, and operation may inherit from other classes
in separate designated
compartments
Benefits of Class Diagram

• Class Diagram Illustrates data models for even very complex information
systems
• It provides an overview of how the application is structured before
studying the actual code.
• This can easily reduce the maintenance time
• It helps for better understanding of general schematics of an application.
• Allows drawing detailed charts which highlights code required to be
programmed
• Helpful for developers and other stakeholders.
elements of A UML class diagram
• Following rules must be taken
• Class Name care of while representing a class:
• Attributes • A class name should always start
with a capital letter.
• Operations
• A class name should always be in
the center of the first
compartment.
• A class name should always be
written in bold format.
• An abstract class name should be
written in italics format.
Attributes:
• A derived attribute is computed
• An attribute is named property from other attributes. For
of a class which describes the example, an age of the student
object being modeled. In the can be easily computed from
class diagram, this component is his/her birth date.
placed just below the name-
compartment.
Attributes characteristics
• The attributes are generally written along with the visibility factor.
• Public, private, protected are the four visibilities which are denoted
by +, -, #, respectively.
• Visibility describes the accessibility of an attribute of a class.
• Attributes must have a meaningful name that describes the use of it
in a class.
Relationships Dependency

• There are mainly three kinds of


• A dependency means the
relationships in UML:
relation between two or more
• Dependencies classes in which a change in one
• Generalizations may force changes in the other.
• Associations • Dependency indicates that one
class depends on another.
• In the following example,
Student has a dependency on
College
Generalization:
• A generalization helps to connect a
subclass to its superclass.
• A sub-class is inherited from its
superclass.
• Generalization relationship can't be used
to model interface implementation.
• Class diagram allows inheriting from
multiple superclasses.

• In this example, the class Student is


generalized from Person Class.
Association

• An association represents a family of


links.
• A binary association (with two ends)
is normally represented as a line.
• An association can link any number
of classes.
• An association with three links is
called a ternary association.
• An association can be named, and
the ends of an association can be
adorned with role names, ownership
indicators, multiplicity, visibility, and
other properties.
multiplicity of an association 
We can indicate the multiplicity of an association by adding multiplicity adornments
to the line denoting the association.

A single student can associate with


multiple teachers:

The example indicates that every Instructor


has one or more Students:

We can also indicate the behavior of an object in an


association (i.e., the role of an object) using role
names.
Aggregation and Composition
• Aggregation and Composition are subsets of association meaning they are
specific cases of association.
• In both aggregation and composition object of one class "owns" object of
another class.
• Aggregation implies a relationship where the child can exist independently of
the parent.
• Example: Class (parent) and Student (child). Delete the Class and the Students
still exist.
• Composition implies a relationship where the child cannot exist independent
of the parent. Example: House (parent) and Room (child). Rooms don't exist
separate to a House.
Aggregation

• A special type of association.


• It represents a "part of"
relationship.
• Class2 is part of Class1.
• Class A instance is not the
exclusive container of Class
B instance, as in fact the Aggregation can occur when a class is a
same Class B instance has collection or container of other classes, but the
another container/s. contained classes do not have a strong lifecycle
dependency on the container. The contents of
the container still exist when the container is
destroyed.
composition
• The UML representation of a • 1. When attempting to represent
composition relationship shows real-world whole-part
composition as a filled diamond relationships, e.g. an engine is a
shape on the containing class part of a car.
end of the lines that connect • 2. When the container is
contained class(es) to the destroyed, the contents are also
containing class. destroyed, e.g. a university and
its departments.
UMLClass diagram for Bank System

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy