Ds 5
Ds 5
UNIT-2
Introduction to UML: Importance of modeling, principles of modeling, object
oriented modeling, conceptual model of the UML, Architecture, Software
Development Life Cycle. Structural Modeling: Classes, Relationships, common
Mechanisms, and diagrams. Case Study: Control System: Traffic Management.
1.1.Introduction to UML:
UML is a standard language for specifying,
visualizing, constructing, and documenting the
artifacts of software systems.
UML was created by the Object Management
Group (OMG) and UML 1.0 specification draft
was proposed to the OMG in January 1997.
OMG is continuously making efforts to create a
truly industry standard.
UML stands for Unified Modelling Language.
UML is different from the other common programming languages such as
C++, Java, COBOL, etc.
UML is a pictorial language used to make software blueprints.
UML can be described as a general purpose visual modeling language to
visualize, specify, construct, and document software system.
Although UML is generally used to model software systems, it is not
limited within this boundary. It is also used to model non-software systems
as well. For example, the process flow in a manufacturing unit, etc.
The UML is process independent.
UML is not a programming language, it is rather a visual language.
UML diagrams are not only made for developers but also for business
users, common people, and anybody interested to understand the 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.
🖝 The UML was developed in 1994-95 by Grady Booch, Ivar Jacobson, and
James Rumbaugh at the Rational Software. In 1997, it got adopted as a
standard by the Object Management Group (OMG).
The UML is a language for
Visualizing
Specifying
Constructing
Documenting
The artifacts of a software-intensive system.
1
Downloaded by satya vara vinod Ungarala ([email protected])
lOMoARcPSD|24075426
1.3.principles of modelling:
UML is basically a modeling language; hence its principles will also be related to
modeling concepts. Here are few basic principal of UML.
First: "The choice of what models to create has a profound influence on how a
problem is attacked and how a solution is shaped"
In other words , choose your models well. The right models will brilliantly illuminate the
most wicked development problems. The wrong models will mislead you, causing you to
focus on irrelevant issues.
Second: " Every model may be expressed at different levels of precision ".
Best approach to a given problem results in a best model. If the problem is complex
mechanized level of approach & if the problem is simple decent approach is followed.
The model built should have strong resemblance with the system.
Fourth: " No single model is sufficient. Every nontrivial system is best approached
through a small set of nearly independent models."
• If you constructing a building, there is no single set of blueprints that reveal all its details.
At the very least, you will need floor plans, elevations , electical plans, heating plans, and
plumbing plans.
In this approach, the main building blocks of all software is the procedure or function .This
view leads developers to focus on issues of control and decomposition of larger
algorithms into smaller ones.
2.Object-Oriented perspective:
In this approach, the main building blocks of all software is the object or class. Simply
put, an object is a thing. A class is a description of a set of common objects. Every object has
identity, state and behavior.
For example, consider a simple a three-tier -architecture for a billing system, involving a user
interface ,middleware, and a data base. In the user interface, you will find concrete objects, such
as buttons, menus, and dialog boxes. In the database, you will find concrete objects ,such as
tables. In the middle layer ,you will find objects such as transitions and business rules.
4
Downloaded by satya vara vinod Ungarala ([email protected])
lOMoARcPSD|24075426
These things are the basic object-oriented building blocks of the UML. You use
them to write well-formed models.
5
Downloaded by satya vara vinod Ungarala ([email protected])
lOMoARcPSD|24075426
1. Structural Things
Structural things are the nouns of UML models. These are mostly static
parts of a model, representing elements that are either conceptual or physical.
Collectively, the structural things are called classifiers.
There are 7 kinds of Structural things:
1. Class
2. Interface
3. Collaboration
4. Use case
5. Active class
6. Component
7. Node
1.Class:-
• A class is a description of a set of objects that
share the same attributes, operations,
relationships and semantics.
• A class implements one or more interfaces.
Graphically, a class is rendered as a rectangle,
usually including its name, attributes, and
operations.
2.Interface:
• An interface is a collection of operations that
specify a service of a class or component. An
interface therefore describes the externally visible
behavior of that element.
• An interface might represent the complete behavior
of a class or component or only a part of that
behavior.
• Interface is represented by a circle as shown
in the following figure. It has a name which is generally written below the
circle.
3.Collaboration:
• A collaboration defines an interaction and is a
society of roles and other elements that work
together to provide some cooperative behavior
that's bigger than the sum of all the elements.
• Collaborations have structural, as well as
behavioral, dimensions. A given class or object
might participate in several collaborations.
• Graphically, a collaboration is rendered as
6
Downloaded by satya vara vinod Ungarala ([email protected])
lOMoARcPSD|24075426
7.Node:
2. Behavioral Things
They are the verbs that encompass the dynamic parts of a model. It depicts
the behavior of a system.
There are two types of behavioral things
1. Interaction
2. State machine.
1.Interaction − Interaction is defined as a behavior that consists of a group of
7
Downloaded by satya vara vinod Ungarala ([email protected])
lOMoARcPSD|24075426
2.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.
Graphically, a state is rendered as a rounded rectangle, usually including its
name and its substates
8
Downloaded by satya vara vinod Ungarala ([email protected])
lOMoARcPSD|24075426
0..1
Employer
3. Generalization :Third, a generalization is a specialization/generalization
relationship in which the specialized element (the child) builds on the specification of
the generalized element (the parent). The child shares the structure and the behavior of
the parent. Graphically, a generalization relationship is rendered as a solid line with a
hollow arrowhead pointing to the parent
Generalization
places: between interfaces and the classes or components that realize them,
and between use cases and the collaborations that realize them.
1.5.1.2 Diagrams in the UML:
2. Object diagram:
• An object diagram shows a set of objects and their relationships.
• Object diagrams represent static snapshots of instances of the things
found in class diagrams.
• These diagrams address the static design view or static process view of a
system as do class diagrams, but from the perspective of real or prototypical
cases.
3. Use case diagram:
• A use case diagram shows a set of use cases and actors (a special kind of
class) and their relationships.
• Use case diagrams address the static use case view of a system.
• These diagrams are especially important in organizing and modeling the
behaviors of a system.
4. Sequence diagram:
• Both sequence diagrams and Collaboration diagrams are kinds of
interaction diagrams.
• An interaction diagram shows an interaction, consisting of a set of objects
or roles, including the messages that may be dispatched among them.
10
Downloaded by satya vara vinod Ungarala ([email protected])
lOMoARcPSD|24075426
8.Component diagram:
• A component diagram is shows an encapsulated class and its interfaces,
ports, and internal structure consisting of nested components and
connectors.
• Component diagrams address the static design implementation view of a
system. They are important for building large systems from smaller parts.
9.Deployment diagram:
• A deployment diagram shows the configuration of run-time processing
nodes and the components that live on them.
• Deployment diagrams address the static deployment view of an architecture.
A node typically hosts one or more artifacts.
11
Downloaded by satya vara vinod Ungarala ([email protected])
lOMoARcPSD|24075426
2. Adornments
3. Common Divisions
4. Extensibility mechanisms
12
Downloaded by satya vara vinod Ungarala ([email protected])
lOMoARcPSD|24075426
1. Specifications:-
The UML is more than just a graphical language. Rather, behind every part
of graphical notation there is a specification that provides a textual
statement of the syntax and semantics of that building block.
For example, behind a class icon is a specification that provides the full set
of attributes, operations and behaviors.
You use the UML’s graphical notation to visualize a system; you use the UML’s
specification to state the system details.
2. Adornments:-
• Most elements in the UML have a unique and direct graphical notation that
provides a visual representation of the most important aspects of the element.
• For example, the notation for a class is intentionally designed to be easy to
draw, because classes are the most common element found in modeling
object-oriented systems.
• The class notation also exposes the most important aspects of a class,
namely its name, attributes, and operations.
13
Downloaded by satya vara vinod Ungarala ([email protected])
lOMoARcPSD|24075426
4. Extensibility Mechanisms:
The UML provides a standard language for writing software blueprints, but it
is not possible for one closed language to ever be sufficient to express all
possible nuances of all models across all domains across all time.
The UML's extensibility mechanisms include:
Stereotypes
Tagged values
Constraints
1.Stereotypes: Extend the vocabulary of the UML by creating new model elements
derived from existing ones but that have specific properties suitable for your
domain/problem.
14
Downloaded by satya vara vinod Ungarala ([email protected])
lOMoARcPSD|24075426
• The selection of the structural elements and their interfaces by which the
system is composed
• Their behavior, as specified in the collaborations among those elements
• The composition of these structural and behavioral elements into
progressively larger subsystems
Software architecture is not only concerned with structure and behavior, but
also with usage, functionality, performance, resilience, reuse,
comprehensibility, economic and technology constraints and trade-offs, and
aesthetic concerns.
UML plays an important role in defining different perspectives of a
system. These perspectives are:
• Usecase View
15
Downloaded by satya vara vinod Ungarala ([email protected])
lOMoARcPSD|24075426
• Design View
• Process View
• Implementation View
• Deployment View
The center is the Use Case view which connects all these four.
A Use case: represents the functionality of the system, it Specify the shape
of the system's architecture .So the other perspectives are connected with
use case.
Design of a system consists of classes, interfaces and collaboration. UML
provides class diagram, object diagram to support this.
• This view primarily supports the functional requirements of the
system, meaning the services that the system should provide to its
end users.
Implementation defines the components assembled together to make a
complete physical system. UML component diagram is used to support
implementation perspective
• This view primarily addresses the configuration management of the
system's releases
Process defines the flow of the system. So the same elements as used in
Design are also used to support this perspective.
• This view primarily addresses the performance, scalability, and
throughput of the system.
Deployment represents the physical nodes of the system that forms the
hardware. UML deployment diagram is used to support this perspective.
• This view primarily addresses the distribution, delivery, and
installation of the parts that make up the physical system.
16
Downloaded by satya vara vinod Ungarala ([email protected])
lOMoARcPSD|24075426
• Architecture-centric
• Iterative and incremental
Use case driven : means that use cases are used as a primary artifact for
establishing the desired behavior of the system, for verifying and validating
the system's architecture, testing, communicating among the stakeholders
of the project.
Architecture-centric means that a system's architecture is used as a primary
artifact for conceptualizing, constructing, managing, and evolving the
system under development.
An iterative process is one that involves managing a stream of executable
releases. An iterative and incremental process is risk-driven, meaning that
each new release is focused on attacking and reducing the most significant
risks to the success of the project.
• This use case driven, architecture-centric, and iterative/incremental process
can be broken into four phases. A phase is the span of time between two
major milestones of the process.
• There are four phases in the software development life cycle:
inception, elaboration, construction, and transition
Inception is the first phase of the process, when the seed idea for the development
is brought up to the point of being at least internally sufficiently well-founded to
warrant entering into the elaboration phase.
Elaboration is the second phase of the process, when the product vision and its
architecture are defined. In this phase, the system’s requirements are prioritized
and baselined.
Construction is the third phase of the process, when the software is brought
from an executable architectural baseline to being ready to be transitioned to the
user community.
Transition is the fourth phase of the process, when the software is turned into
the hands of the user community. Rarely does the software development process
end here, for even during this phase, the system is continuously improved, bugs
are eradicated and features that didn’t make an earlier release are added.
17
Downloaded by satya vara vinod Ungarala ([email protected])
lOMoARcPSD|24075426
Deployment diagrams
Component diagram
Class diagram is the most widely used structural diagram.
1. Classes:
Terms and Concepts:
A class is a description of a set of objects that share the same attributes,
operations, relationships, and semantics. Graphically, a class is rendered
18
Downloaded by satya vara vinod Ungarala ([email protected])
lOMoARcPSD|24075426
as a rectangle.
Names
• Every class must have a name that distinguishes it from other classes.
• A name is a textual string. That name alone is known as a simple name; a
qualified name is the class name prefixed by the name of the package in
which that class lives. A class may be drawn showing only its name.
Attributes:
• An attribute is a named property of a class that describes a range of
values that instances of the property may hold.
• A class may have any number of attributes or no attributes at all.
• An attribute represents some property of the thing you are modeling that is
shared by all objects of that class.
Operations
• An operation is the implementation of a service that can be requested
from any object of the class to affect behavior.
• an operation is an abstraction of something you can do to an object
that is shared by all objects of that class.
• A class may have any number of operations or no operations at all.
Name
Window
Origin
Attributes
Size
class
Open( )
Close( ) Operation
Move( )
Display( )
19
Downloaded by satya vara vinod Ungarala ([email protected])
lOMoARcPSD|24075426
Responsibilities
A responsibility is a contract or an obligation of a class. When you create a
class, you are making a statement that all objects of that class have the same
kind of state and the same kind of behavior.
2.Relationships
Terms and Concepts
• A relationship is a connection among things.
• In object-oriented modeling, the three most important relationships are
dependencies, generalizations, and associations.
• Graphically, a relationship is rendered as a path, with different
kinds of lines used to distinguish the kinds of relationships.
Dependencies:
A dependency is a relationship that states that one thing (for
example, class Window) uses the information and services of another
thing (for example, class Event), but not necessarily the reverse.
Graphically, a dependency is rendered as a dashed directed line,
directed to the thing being depended on.
Choose dependencies when you want to show one thing using another.
Generalizations:
20
Downloaded by satya vara vinod Ungarala ([email protected])
lOMoARcPSD|24075426
Associations:
• An association is a structural relationship that specifies that objects
of one thing are connected to objects of another.
• Given an association connecting two classes, you can relate objects
of one class to objects of the other class.
• An association that connects exactly two classes is called a
binary association..
• Beyond this basic form, there are four adornments that apply to associations.
Name:
An association can have a name, and you use that name to describe the nature
of the relationship. So that there is no ambiguity about its meaning, you can
give a direction to the name by providing a direction triangle that points in the
direction you intend to read the name.
Role:
• When a class participates in an
association, it has a specific role that
it plays in that relationship; a role is
just the face the class at the far end
of the association presents to the
class at the near end of the
association.
• You can explicitly name the role a
21
Downloaded by satya vara vinod Ungarala ([email protected])
lOMoARcPSD|24075426
Multiplicity:
• An association represents a structural relationship among objects.
• In many modeling situations, it's important for you to state how
many objects may be connected across an instance of an
association.
• This "how many" is called the multiplicity of an association's role.
• It represents a range of integers specifying the possible size of
the set of related objects.
The number of objects must be in the given range. You can show a
multiplicity of exactly one (1), zero or one (0..1), many (0..*), or one or more
(1..*). You can give an integer range (such as 2..5). You can even state an
exact number (for example, 3, which is equivalent to 3..3).
Aggregation:
Composition:-
22
Downloaded by satya vara vinod Ungarala ([email protected])
lOMoARcPSD|24075426
3. Common Mechanisms:
Terms and Concepts:
A note is a graphical symbol for rendering constraints or comments
attached to an element or a collection of elements. Graphically, a note
is rendered as a rectangle with a dog-eared corner, together with a
textual or graphical comment.
23
Downloaded by satya vara vinod Ungarala ([email protected])
lOMoARcPSD|24075426
24
Downloaded by satya vara vinod Ungarala ([email protected])
lOMoARcPSD|24075426
Other Adornments:
Adornments are textual or graphical items that are added to an element's
basic notation and are used to visualize details from the element's
specification
4.Diagrams: