3 Uml
3 Uml
3 Uml
Raj Singh
The Unified Modeling Language (UML) is a general purpose modeling language designed
to provide a standard way to visualize the design of a system.
Created and developed by Grady Booch, Ivar Jacobson and James Rumbaugh at Rational
Software during 1994–95 with further development led by them through 1996.
In 2000 UML was also accepted by the International Organization for Standardization(ISO)
as an approved ISO standard.
2
Used to help
communicate some
Most common use of
aspect of a system
UML
and to better
understand it
3
Goal is completeness
Used to describe a detailed design for a programmer to follow in writing source code
It can be used by a designer to develop blueprint-level models that show interfaces of subsystems or classes
As a reversed engineered product, diagrams convey detailed information about the source code that is easier for
software engineers to understand
4
Specifies the complete system in UML so that code
can be automatically generated
5
UML sketches are useful with both forward and
reverse engineering and in both conceptual and
software perspectives
Detailed forward
engineering blueprints are Actual implementation of
interfaces will reveal the needs
difficult to do well and slow for changes
down the development effort
6
DIAGRAM NAME PURPOSE
7
DIAGRAM NAME PURPOSE
State Machine Models how events change an object over its life
8
Class
Diagram
Component
Diagram
Structure Composite
Diagram Structure Diagram
Deployment
Diagram
Object
Diagram
Package
UML Diagram Diagram
Sequence
Use Case
Diagram
Diagram
Behavior Communication
Activity
Diagram Diagram
Diagram
Interaction
Interaction Overview
Diagram Diagram
State Machine Timing
Diagram Diagram
9
Use case / scenario defines how a user uses a
system to accomplish a particular goal.
10
What are the main tasks or functions that are
performed by the actor?
11
Make automated menu
selections Expert Menu
System
Cook
Notify customer that
food and drink are ready
Customer
13
Describe situations that may cause the system to exhibit unusual
behavior
Are there cases where a validation function occurs for the use case?
13
enter password
and user ID
Supplements the use case by valid passwor ds/ID invalid passwor ds/ID
representation
other f unctions
may also be
selected
input tr ies r emain
select surveillance
no input
tr ies remain
prompt for
another view
14
homeowner c a m e ra i n t e rf a c e
enter password
and user ID
use-case selected
select surveillance
in p u t tries
r emain
n o in p u t
tr ies r emain
exit th is
fu n ctio n
see
an o th er
cam er a
15
Class-based modeling The elements of a class-based
represents model include
objects that the system will manipulate classes and objects
operations (also called methods or services) attributes and operations
relationships between the objects collaboration diagrams and packages
collaborations that occur between the classes
16
Classes are determined by underlining each noun or noun
phrase and entering it into a simple table
17
External entities
• (e.g. other systems, devices, people) that produce or consume information
Things
• (e.g. reports, displays, letters, signals) that are part of the information domain for
the problem
Occurrences or events
• (e.g. completion of actions) that occur within the context of system operation
Roles
• (e.g. manager, engineer, salesperson) played by people who interact with the
system
Organizational units
• (e.g. division, group, team) that are relevant to an application
Places
• (e.g. manufacturing floor) that establish the context of the problem and the
overall function
Structures
• (e.g. sensors, computers) that define a class of objects or related classes of
objects
18
Attributes describe a class that has been Attributes describe the structure
selected for inclusion in the analysis and value of an instance of a class.
model.
19
An operation is a method or Operations define the Operations can perform
function that can be behavior of a class, what a computation, take an action,
performed by a class. class can do. call another method, etc.
20
Entity classes Boundary classes Controller classes
also called model or business are used to create the manage a “unit of work” from
classes, are extracted directly interface that the user sees start to finish
from the statement of the and interacts with the
problem software
21
System intelligence should be distributed across
classes to best address the needs of the problem
22
a class can use its own operations to fulfill a
Classes fulfill their responsibilities particular responsibility
in one of two ways: a class can collaborate with other classes
23
Association is a (*a*) Aggregation, a special Composition can be Aggregation is a special
relationship between two type of an association, is recognized as a special kind of an association
classes, where one class the (*the*) relationship type of an aggregation. and composition is a
use another between two classes. special kind of an
aggregation.
Association is non-directional, Association àAggregation
aggregation insists a direction. àComposition
24
26
Player
27
Wall
1 1 1
28
DisplayWindow Camera
<<access>>
{password}
28
The behavioral model indicates how software will
respond to external events.
29
In the context of
behavioral modeling, two • the state of each class as the system performs its function and
different characterizations • the state of the system as observed from the outside as the
of states must be system performs its function
considered:
30
State State transition Event Action
a set of observable the movement from an occurrence that process that occurs as
circum-stances that one state to another causes the system to a consequence of
characterizes the exhibit some making a transition
behavior of a system predictable form of
at a given time behavior
31
timer < lockedTime
password = incorrect
& numberOfTries < maxTries
selecting
activation successful
33
homeowner control panel system sensors
sensors
system reading
A
ready
password entered
request lookup
comparing
result
password = correct
num berOfTries > m axTries request activation
locked
selecting
another activity.
determineDiscount
returns: discount add lineCost to
totalCost
discount>0
totalCost=
totalCost - discount
discount <= 0
priceTotal =
totalCost + taxTotal
+ shippingCost
36
Used to take any construct in UML and group its
elements together into higher-level units
Notification IncidentManagement
Represented by a tabbed folder, where the tab
contains the package name
37
Shows the physical architecture of the
hardware and software of the deployed
system
An activity diagram shows the context for use cases and also
the details of how a complicated use case works
A class diagram drawn from the It also shows the attributes and
conceptual perspective is a good operations of interest in
domain classes and the
way of building up a rigorous relationships among the
vocabulary of the domain classes
39
A class diagram drawn from the software perspective
can show design classes, their attributes and operations,
and their relationships with the domain classes
40
Complements the written documentation and in some
instances can replace it
41
Review class notes. Additional reading: Start a discussion on Google
Examples of UML diagrams Groups to clarify your doubts.
42