SlideShare a Scribd company logo
UML & RUPUML & RUP
Introduction toIntroduction to
UMLUML
Vaquar khanVaquar khan
What is UML?What is UML?
• We need to build models for Software-We need to build models for Software-
intensive systems.intensive systems.
• Just as there exists a common languageJust as there exists a common language
for construction industry, electronics/for construction industry, electronics/
electrical industry; UML is a commonelectrical industry; UML is a common
language for visual modeling in softwarelanguage for visual modeling in software
industry.industry.
What is UML?What is UML?
• UML is appropriate for modeling systemsUML is appropriate for modeling systems
ranging from enterprise informationranging from enterprise information
systems to distributed web applicationssystems to distributed web applications
and even to hard real time embeddedand even to hard real time embedded
systems.systems.
• UML is process independent(although itUML is process independent(although it
optimally can be used for RUP.)optimally can be used for RUP.)
What is UML?What is UML?
• The UML is language forThe UML is language for
visualizingvisualizing
specifyingspecifying
constructingconstructing
documentingdocumenting
the artifacts of a software intensive systemthe artifacts of a software intensive system
What is UML?What is UML?
• VisualizingVisualizing
Explicit model facilitates communication.Explicit model facilitates communication.
Some structures transcend what can beSome structures transcend what can be
represented in programming languagerepresented in programming language
Each symbol has well-defined semanticsEach symbol has well-defined semantics
behind itbehind it
What is UML?What is UML?
SpecifyingSpecifying
The UML addresses the specification of allThe UML addresses the specification of all
important analysis, design, andimportant analysis, design, and
implementation decisions.implementation decisions.
What is UML?What is UML?
ConstructingConstructing
Forward engineering: generation of code fromForward engineering: generation of code from
model into programming language.model into programming language.
Reverse engineering: reconstructing model fromReverse engineering: reconstructing model from
implementationimplementation
Round-trip engineering: going both waysRound-trip engineering: going both ways
What is UML?What is UML?
DocumentingDocumenting
Artifacts include:deliverables, such asArtifacts include:deliverables, such as
requirements documents,functionalrequirements documents,functional
specifications, and test plans.specifications, and test plans.
materials that are critical in controlling, measuring,materials that are critical in controlling, measuring,
and communicating about a system duringand communicating about a system during
development and after deploymentdevelopment and after deployment
Building blocks of UMLBuilding blocks of UML
• ThingsThings(icons/symbols)(icons/symbols)
• RelationshipsRelationships(among the things)(among the things)
• Diagrams(Diagrams(combination of things andcombination of things and
relationships)relationships)
• Extensibility Mechanisms(Extensibility Mechanisms(extendextend
vocabulary of UML)vocabulary of UML)
Diagrams in UMLDiagrams in UML
The following diagrams provide theThe following diagrams provide the staticstatic
viewview of the system.of the system.
Class DiagramClass Diagram
Object DiagramObject Diagram
Component DiagramComponent Diagram
Deployment DiagramDeployment Diagram
Diagrams in UMLDiagrams in UML
The following diagrams provide theThe following diagrams provide the dynamicdynamic
viewview of the system.of the system.
Use case DiagramUse case Diagram
Sequence DiagramSequence Diagram
Collaboration DiagramCollaboration Diagram
Statechart DiagramStatechart Diagram
Activity DiagramActivity Diagram
Diagrams in UMLDiagrams in UML
• Class Diagrams represent the static structure inClass Diagrams represent the static structure in
terms of classes and relationships.terms of classes and relationships.
• Object Diagrams represent object and theirObject Diagrams represent object and their
relationships.relationships.
• Use case Diagrams represent the functions of aUse case Diagrams represent the functions of a
system from the user’s point of view.system from the user’s point of view.
• Sequence Diagrams represent interactionsSequence Diagrams represent interactions
among the objects on time scaleamong the objects on time scale
Diagrams in UMLDiagrams in UML
• Collaboration Diagrams are a spatialCollaboration Diagrams are a spatial
representation of objects, links and interactionsrepresentation of objects, links and interactions
• Statechart Diagrams represent the behavior ofStatechart Diagrams represent the behavior of
an object in terms of its state changes.an object in terms of its state changes.
• Activity Diagrams represent the behavior of anActivity Diagrams represent the behavior of an
operation as a set of actionsoperation as a set of actions
Diagrams in UMLDiagrams in UML
• Component Diagrams represent theComponent Diagrams represent the
physical components of the application.physical components of the application.
• Deployment Diagrams represent theDeployment Diagrams represent the
deployment of the components ondeployment of the components on
particular pieces of hardware.particular pieces of hardware.
Class DiagramClass Diagram
• A class is represented by a rectangle in UMLA class is represented by a rectangle in UML
• Initial uppercase letterInitial uppercase letter
• first letter of second word capitalized.first letter of second word capitalized.
WashingMachine
Icon for class
Class DiagramClass Diagram
• Classes can be grouped into aClasses can be grouped into a packagepackage
• UML represents a package as a tabbed folder.UML represents a package as a tabbed folder.
Household Appliances
A UML package
Class DiagramClass Diagram
• AA classclass name with thename with the packagepackage name isname is
called acalled a pathname.pathname.
Household Appliances:: WashingMachine
Class DiagramClass Diagram
• AnAn attributeattribute is a property of a class.Itis a property of a class.It
describes a range of values that thedescribes a range of values that the
property may hold in objects(i.e.property may hold in objects(i.e.
instances)of that class.instances)of that class.WashingMachine
brandName
modelName
serialNumber
capacity
A class & its attributes
Class DiagramClass Diagram
• AnAn operationoperation is something that a class canis something that a class can
do, or that you(or another class)can do todo, or that you(or another class)can do to
a class.a class. WashingMachine
brandName
modelName
serialNumber
capacity
addClothes()
Removeclothes()
addDetergent()
turnOn()
Class DiagramClass Diagram
• VisibilityVisibility
WashingMachine
-brandName
-modelName
…
+addClothes()
+removeClothes()
#turnOn()
…
-private
+public
#protected
Class DiagramClass Diagram
• ElidingEliding a class and use ofa class and use of ellipsisellipsis
WashingMachine
brandName
...
ellipsis
addClothes()
...
Class DiagramClass Diagram
• Use ofUse of stereotypesstereotypes
WashingMachine
<<id info>>
brandName
modelName
serialNumber
<<machine info>>
capacity
<<clothes related>>
addClothes()
stereotypes
(can be used to
organize a list
of attributes or
operations)
Class DiagramClass Diagram
• Use ofUse of constraintconstraint andand notesnotes
WashingMachine
brandName
modelName
serialNumber
capacity
addClothes()
removeClothes()
addDetergent()
turnOn()
{capacity=16
or 18 or 20 lb.}
constraint
Ref: Govt.std
EV5-2241 for
serial nos.
note
Class DiagramClass Diagram
• InterfaceInterface
An interface specifies the
externally-visible operations of a
class and/or component, and has no
implementation of its own. An
interface typically specifies only a
limited part of the behavior of a
class or component.
notation
interface
iconic
Class DiagramClass Diagram
• Interface: expanded form representationInterface: expanded form representation
using stereotype.using stereotype.
<<interface>>
ImageObserver
Class DiagramClass Diagram
• How to find classes?How to find classes?
Classes represent the vocabulary of anClasses represent the vocabulary of an
area of knowledge.Conversations with aarea of knowledge.Conversations with a
client or an expert in that area revealsclient or an expert in that area reveals
nouns that can become classes in anouns that can become classes in a
model and verbs that can becomemodel and verbs that can become
operations.operations.
Class DiagramClass Diagram
Class RelationshipsClass Relationships
• AssociationAssociation
• MultiplicityMultiplicity
• AggregationAggregation
• CompositionComposition
• DependencyDependency
• InheritanceInheritance
Class DiagramClass Diagram
• AssociationAssociation
An association between a player and aAn association between a player and a
teamteam
Player Team
Plays on
Class DiagramClass Diagram
• AssociationAssociation
Serves
{ordered}
CustomerBank Teller
Constraint on
association
Class DiagramClass Diagram
• Association classAssociation class
Person Company
Employee
Employer
contract
Role names
Association class
Class DiagramClass Diagram
• MultiplicityMultiplicity
Multiplicity denotes the no. of objects ofMultiplicity denotes the no. of objects of
one class that can relate to one object ofone class that can relate to one object of
an associated class.an associated class.
Player Team
Plays on5 1
Class DiagramClass Diagram
• CommonCommon multiplicitymultiplicity valuesvalues
Class DiagramClass Diagram
• AggregationAggregation
If two classes share associationIf two classes share association
relationship and one class can be said torelationship and one class can be said to
bebe a part of thea part of the otherother, the relationship is, the relationship is
called aggregation.called aggregation.
Aggregation expresses a relationshipAggregation expresses a relationship
between a ‘whole’ and its ‘ part’.between a ‘whole’ and its ‘ part’.
Class DiagramClass Diagram
chair
book
menu
classroom
library
window
Aggregation
Class DiagramClass Diagram
• CompositionComposition
Composition is a strong type ofComposition is a strong type of
aggregation.Each component in aaggregation.Each component in a
composite can belong to just one whole.composite can belong to just one whole.
The composite is responsible for creationThe composite is responsible for creation
or deletion of itsor deletion of its part.part.
e.g. building and rooms, purchase ordere.g. building and rooms, purchase order
and order line.and order line.
Class DiagramClass Diagram
Coffee Table
Table Top Leg
41
1
Composition
Delete the table and the legs and the top have no existence.
Class DiagramClass Diagram
• DependencyDependency
When the behavior of one class dependsWhen the behavior of one class depends
on the structure and behavior of anotheron the structure and behavior of another
class, the relationship between them isclass, the relationship between them is
called dependency.called dependency.
Class DiagramClass Diagram
• DependencyDependency
If classes A and B do not share any of theIf classes A and B do not share any of the
structural relationships (association,structural relationships (association,
aggregation or composition) and class B isaggregation or composition) and class B is
passed as an argument to a function ofpassed as an argument to a function of
class A, then A is said to depend on B.class A, then A is said to depend on B.
Class DiagramClass Diagram
Course Scheduler
add(c:Course)
remove(c:Course)
Course
Window
handleEvent(e:Event)
draw()
Event
Dependency
Class DiagramClass Diagram
• InheritanceInheritance
When the classes haveWhen the classes have is a kind ofis a kind of relationshiprelationship
between them it is called inheritance.between them it is called inheritance.
The inheritance is explained byThe inheritance is explained by GeneralizationGeneralization
andand Specialization.Specialization.
The classesThe classes having inheritance relationship arehaving inheritance relationship are
parent and child classes.parent and child classes.
Class DiagramClass Diagram
Animal
Amphibian Mammal Reptile
Horse
Inheritance
A typical class diagramA typical class diagram
Use Case DiagramUse Case Diagram
• Use Case AnalysisUse Case Analysis
A software is judged ‘successful’ by its users andA software is judged ‘successful’ by its users and
not by developers.not by developers.
Developers can deliver a successful softwareDevelopers can deliver a successful software
only if they understand user requirements.only if they understand user requirements.
User requirements consists of detailedUser requirements consists of detailed
description of how they want to use the system.description of how they want to use the system.
Use Case DiagramUse Case Diagram
• What is a use case?What is a use case?
A use case is a description of a system’sA use case is a description of a system’s
behavior from a user’s standpoint.behavior from a user’s standpoint.
It is a collection of scenarios aboutIt is a collection of scenarios about
system’s use.system’s use.
Use case
A use case is shown
as an ellipse
Use Case DiagramUse Case Diagram
• Example: How to find the use cases for aExample: How to find the use cases for a
washing machine?washing machine?
Ask the question: Why would a userAsk the question: Why would a user
interact with the washing machine?interact with the washing machine?
The answer will describe the functionalityThe answer will describe the functionality
desired by the user. The verbs will givedesired by the user. The verbs will give
us the use cases of the system.us the use cases of the system.
Use Case DiagramUse Case Diagram
The washing machine as a system will haveThe washing machine as a system will have
following use cases.following use cases.
Wash
clothes
Rinse
clothes
Dry
clothes
User
Use Case DiagramUse Case Diagram
• ActorActor
An actor is anyone or anything thatAn actor is anyone or anything that
interacts with the system being built.interacts with the system being built.
While use cases describe anything that isWhile use cases describe anything that is
inside the system scope, actors areinside the system scope, actors are
anything that is outside the system scope.anything that is outside the system scope.
Use Case DiagramUse Case Diagram
• ActorActor
An actor is shown as a stick figure.An actor is shown as a stick figure.
Actor
Use Case DiagramUse Case Diagram
Use Case
User
Programmer Tester
Architect
Analyst
understands
implements
verifies
expresses
designs
Use Case DiagramUse Case Diagram
• Scenarios for the use case ‘Wash clothes’Scenarios for the use case ‘Wash clothes’
Open flap Machine starts washingOpen flap Machine starts washing
Add clothes If timer’s time is out,Add clothes If timer’s time is out,
Add soap machine gives alarmAdd soap machine gives alarm
Add waterAdd water
Close flapClose flap
Set modeSet mode
Set TimerSet Timer
This is the normal behavior
of the machine
Use Case DiagramUse Case Diagram
• The behavior of the machine may change inThe behavior of the machine may change in
exceptional cases.exceptional cases.
e.g. how would machine respond ife.g. how would machine respond if
-user overloads the machine-user overloads the machine
-user forgets to disengage drainage pipe-user forgets to disengage drainage pipe
-in the process of washing there is power-in the process of washing there is power
failurefailure
Use Case DiagramUse Case Diagram
• When a use case is described there couldWhen a use case is described there could
bebe
many sets of sequences/events which canmany sets of sequences/events which can
be categorized into-be categorized into-
1. Main Flow of events1. Main Flow of events
2. Alternate flow of events2. Alternate flow of events
3. Exceptional flow of events3. Exceptional flow of events
Use Case DiagramUse Case Diagram
• Primary and Secondary Use casesPrimary and Secondary Use cases
A primary use case is a description of set ofA primary use case is a description of set of
sequence of actions that a system (and actor)sequence of actions that a system (and actor)
perform, that yields an observable result of valueperform, that yields an observable result of value
to a particular actorto a particular actor
e.g Wash clothes is a primary use case becausee.g Wash clothes is a primary use case because
it returns the user, theit returns the user, the washedwashed clothes,clothes, anan
observable result of value to the userobservable result of value to the user
Use Case DiagramUse Case Diagram
Open flap Machine starts washingOpen flap Machine starts washing
Add clothes If timer’s time is out,Add clothes If timer’s time is out,
Add soap machine gives alarmAdd soap machine gives alarm
Add waterAdd water
Close flapClose flap
Set modeSet mode
Set TimerSet Timer
Load machine
Secondary use case
Use Case DiagramUse Case Diagram
• Load machine doesn’t return a completeLoad machine doesn’t return a complete
service of value.service of value.
Hence it is a Secondary Use CaseHence it is a Secondary Use Case
The secondary use case can be found byThe secondary use case can be found by
capturing common scenarios in Use Casecapturing common scenarios in Use Case
DescriptionsDescriptions
Use case RelationshipsUse case Relationships
<<include>>:<<include>>:
<<include>> relationship shows a necessary<<include>> relationship shows a necessary
connection between use cases.connection between use cases.
The included use case can be identified in twoThe included use case can be identified in two
ways.ways.
1.1. Included use case might be preexisting and inIncluded use case might be preexisting and in
the development of another use case , thethe development of another use case , the
same behavior is required.same behavior is required.
2.2. To pull the functionality out of the existing useTo pull the functionality out of the existing use
cases to form a new use case.cases to form a new use case.
Use case RelationshipsUse case Relationships
To use the <<include>> relationship the use casesTo use the <<include>> relationship the use cases
must conform to two constraints.:must conform to two constraints.:
1. The calling use case may only depend on the1. The calling use case may only depend on the
result from the called use case. It can have noresult from the called use case. It can have no
knowledge of the internal structure of the calledknowledge of the internal structure of the called
use case.use case.
2. The calling use case must always require the2. The calling use case must always require the
execution of the called use case. The use of theexecution of the called use case. The use of the
called use case is unconditional.called use case is unconditional.
Use case RelationshipsUse case Relationships
The included use case can be calledThe included use case can be called
independently by the actor.independently by the actor.
Use Case DiagramUse Case Diagram
• <<extend>><<extend>>
• It is used to show an optional behavior forIt is used to show an optional behavior for
a use case, which is required only undera use case, which is required only under
certain conditions.certain conditions.
• If two use cases are connected byIf two use cases are connected by extendextend
relationship, one is invoked if somerelationship, one is invoked if some
conditions occurs in another use case.conditions occurs in another use case.
Use Case DiagramUse Case Diagram
1………………
2………………
3 …[condition]
………………
………………
20 ……………
1…………
2…………
3…………
………….
………….
………….
10……….
False
True
Money
Overdrawn
Withdraw
Money
<<extend>>
Use case RelationshipsUse case Relationships
• Generalization / Inheritance :Generalization / Inheritance :
• Use case B is said to be inherited from use case A if :Use case B is said to be inherited from use case A if :
• 1.1. B is a specialized use case and A is more general oneB is a specialized use case and A is more general one
• 2.2. The child use case (B) inherits the behavior sequenceThe child use case (B) inherits the behavior sequence
of the parent (A) and may insert additional behavior into itof the parent (A) and may insert additional behavior into it
• 3.3. B can be said to be ‘is a kind of‘ AB can be said to be ‘is a kind of‘ A
Use case RelationshipsUse case Relationships
• 1.1. Read cardRead card 1.1. Read cardRead card
• 2.2. Get pin numberGet pin number 2.2. GetGet
pin numberpin number
• 3.3. Validate pin number 3.Validate pin number 3. Validate pinValidate pin
numbernumber
• 4.4. Get transaction 4.Get transaction 4. GetGet
transactiontransaction
• 5.5. Get amount 5.Get amount 5. Show balanceShow balance
• 6.6. Dispense money 6.Dispense money 6. Eject cardEject card
• 7 Print report7 Print report
• 8.8. Eject cardEject card
Perform
Transaction
Capturing commonality
Withdraw money Display balance
Enter the appropriate relationshipsEnter the appropriate relationships
for the following use case diagram forfor the following use case diagram for
ATMATM
Uml &amp; rup
Use case Analysis : SummaryUse case Analysis : Summary
1.1. Find out possible users / actors for the systemsFind out possible users / actors for the systems
for whom is the system developed? Who are thefor whom is the system developed? Who are the
beneficiaries?beneficiaries?
2.2. Find out what fundamental services (Use Cases) the actors,Find out what fundamental services (Use Cases) the actors,
expect from the systemexpect from the system
-- why would an actor interact with the system ?-- why would an actor interact with the system ?
3.3. Depict the interactions between each actor and the servicesDepict the interactions between each actor and the services
the actor expects from the systemthe actor expects from the system
-- drawing a use case diagram-- drawing a use case diagram
4.4. Detail each use case in terms of scenarios / sequence ofDetail each use case in terms of scenarios / sequence of
actions performed by actors and systemactions performed by actors and system
-- develop use case documentation-- develop use case documentation
5.5. Find out relationships the various use cases may haveFind out relationships the various use cases may have
Use Case realizationUse Case realization
• Finding out key objects withFinding out key objects with
responsibilitiesresponsibilities
• Determining basic object interactionsDetermining basic object interactions
• Finding classes & determining classFinding classes & determining class
relationshipsrelationships
Discovering ObjectsDiscovering Objects
1.1. Underline the nouns that occur in all the relevant useUnderline the nouns that occur in all the relevant use
case scenarios.case scenarios.
2.2. Select the nouns / objects that might share theSelect the nouns / objects that might share the
responsibilities.responsibilities.
3.3. List the basic responsibilities that the objects shouldList the basic responsibilities that the objects should
share.share.
3.3. Match each object with well defined responsibilities.Match each object with well defined responsibilities.
4.4. Investigate if any conceptual objects are requiredInvestigate if any conceptual objects are required
5.5. Work out the (tentative) list of attributes and methodsWork out the (tentative) list of attributes and methods
to be supported by these objects, based on theirto be supported by these objects, based on their
responsibilitiesresponsibilities
Types Of ObjectsTypes Of Objects
Boundary Object Control Object Entity ObjectBoundary Object Control Object Entity Object
Input from
& output to
Environment
localized here
Processing and
flow of control
localized here
Storage of data
localized here
Objects in the systemObjects in the system
Boundary ObjectsBoundary Objects Control ObjectsControl Objects EntityEntity
ObjectsObjects
Card Reader Transaction Manager AccountCard Reader Transaction Manager Account
Display Validator TransactionDisplay Validator Transaction
PrinterPrinter
Boundary
Control
Entity
Packages
Interaction DiagramsInteraction Diagrams
The interaction diagrams are designed to modelThe interaction diagrams are designed to model
how the objects communicate in order tohow the objects communicate in order to
accomplish the tasks within the operation of theaccomplish the tasks within the operation of the
system.system.
The interaction diagram provides a pathwayThe interaction diagram provides a pathway
from the textual descriptions of behaviors in thefrom the textual descriptions of behaviors in the
scenarios to the operations required by thescenarios to the operations required by the
Class Diagram.Class Diagram.
Interaction DiagramsInteraction Diagrams
• Interaction diagrams can be modeled inInteraction diagrams can be modeled in
two ways.two ways.
1. Sequence Diagram: showing time1. Sequence Diagram: showing time
sequence of messages among thesequence of messages among the
objects.objects.
2. Collaboration Diagram: presents a2. Collaboration Diagram: presents a
structure oriented visualization.structure oriented visualization.
Sequence DiagramSequence Diagram
A sequence diagram is an interactionA sequence diagram is an interaction
diagram that emphasizes the timediagram that emphasizes the time
ordering of messages.ordering of messages.
A lifeline is a vertical dashed line thatA lifeline is a vertical dashed line that
represents the lifetime of an object.represents the lifetime of an object.
A focus of control is a tall, thin rectangle thatA focus of control is a tall, thin rectangle that
shows the period of time during which anshows the period of time during which an
object is performing an action.object is performing an action.
Uml &amp; rup
Uml &amp; rup
Sequence DiagramSequence Diagram
• A sequence diagram is drawn with respectA sequence diagram is drawn with respect
to a context such as System, Subsystemto a context such as System, Subsystem
or a use case.or a use case.
• Typically a sequence diagram will beTypically a sequence diagram will be
drawn for a use case.drawn for a use case.
Sequence DiagramSequence Diagram
Steps for drawing a sequenceSteps for drawing a sequence
diagram.diagram.
1.1. Identify the objects that take part in theIdentify the objects that take part in the
realization of the use case.realization of the use case.
2.2. Place the objects on the diagram fromPlace the objects on the diagram from
left to right.left to right.
3.3. Set the lifelines of the objects.Set the lifelines of the objects.
Sequence DiagramSequence Diagram
4.4. Starting with the message that initiatesStarting with the message that initiates
the interaction, layout each subsequentthe interaction, layout each subsequent
messages from top to bottom betweenmessages from top to bottom between
the lifelines.the lifelines.
5.5. Attach theAttach the notesnotes wherever necessary.wherever necessary.
Sequence DiagramSequence Diagram
• Types of messages:Types of messages:
Synchronous message:Synchronous message:
AA synchronous messagesynchronous message assumes that aassumes that a
return is needed, so the sender waits forreturn is needed, so the sender waits for
the return before proceeding with anythe return before proceeding with any
other activity.other activity.
A synchronous message is shown as a solidA synchronous message is shown as a solid
arrow with a bold head.arrow with a bold head.
Sequence DiagramSequence Diagram
Asynchronous message:Asynchronous message:
The sender just sends out the messageThe sender just sends out the message
and does not wait for a response.and does not wait for a response.
An asynchronous message is shown as aAn asynchronous message is shown as a
solid arrow with a stick head.solid arrow with a stick head.
Sequence DiagramSequence Diagram
• Return Message:Return Message:
A message that represent only the replyA message that represent only the reply
to a message is called ato a message is called a return.return.
A return is represented as a dashedA return is represented as a dashed
arrow .arrow .
-------------------
Sequence DiagramSequence Diagram
• Self-reference message:Self-reference message:
When the sender and the receiver of theWhen the sender and the receiver of the
message are the same object, it is calledmessage are the same object, it is called
as a self-reference message.as a self-reference message.
Collaboration DiagramCollaboration Diagram
A collaboration diagram is an interactionA collaboration diagram is an interaction
diagram that emphasizes the organizationdiagram that emphasizes the organization
of the objects that participate in theof the objects that participate in the
interaction.interaction.
You may have sequence numbers toYou may have sequence numbers to
indicate the time ordering of messages, toindicate the time ordering of messages, to
one or more levels.one or more levels.
Uml &amp; rup
Uml &amp; rup
Collaboration DiagramCollaboration Diagram
Case StudyCase Study
Convert the sequence diagram forConvert the sequence diagram for
GetCoffeeGetCoffee into the collaborationinto the collaboration
diagram.diagram.
State MachinesState Machines
• A state machine is a behavior that specifies theA state machine is a behavior that specifies the
sequences of states an object goes throughsequences of states an object goes through
during its lifetime in response to events, togetherduring its lifetime in response to events, together
with its response to those events.with its response to those events.
• A state machine is used to model the dynamicA state machine is used to model the dynamic
aspects of a system. It is drawn to model theaspects of a system. It is drawn to model the
lifetime of an instance of a class or a use caselifetime of an instance of a class or a use case
or an entire system.or an entire system.
State MachinesState Machines
• A state machine can be visualized in twoA state machine can be visualized in two
ways: by emphasizing the flow of controlways: by emphasizing the flow of control
from activity to activity( by activityfrom activity to activity( by activity
diagrams) or by emphasizing the potentialdiagrams) or by emphasizing the potential
states of the objects and the transitionsstates of the objects and the transitions
among those states (by state chartamong those states (by state chart
diagrams)diagrams)
State chart DiagramState chart Diagram
• It is drawn to show the states of a singleIt is drawn to show the states of a single
object or a subsystem.object or a subsystem.
• It consists of different states of an objectIt consists of different states of an object
triggered by different events and thetriggered by different events and the
signals.signals.
• It is especially useful in modeling reactiveIt is especially useful in modeling reactive
systems.systems.
State chart Diagram
A state is a condition in which an object can
reside during its lifetime while it satisfies
some condition, performs an activity, or waits
for an event.
.
StateState
• The state icon appears as a rectangle withThe state icon appears as a rectangle with
rounded corners and a name. It alsorounded corners and a name. It also
contains a compartment for actions:contains a compartment for actions:
Name
State variables
Activities
Initial and Final States
The initial state is the default starting place
for a state machine.
The final state indicates the completion of the
state machine’s execution.
Filled circle
Bull’s eye
State chart DiagramState chart Diagram
• TransitionTransition
A transition is a relationship between twoA transition is a relationship between two
states indicating that an object in the firststates indicating that an object in the first
state will perform certain actions and enterstate will perform certain actions and enter
the second state when a specified eventthe second state when a specified event
occurs and specified conditions areoccurs and specified conditions are
satisfied.satisfied.
State chart DiagramState chart Diagram
• Parts of a transitionParts of a transition
Idle
Cooling
Temprise[isSetVal]/startComp()
event Guard
condition action
Source state
Target state
State chart DiagramState chart Diagram
• AnAn eventevent is a significant occurrence thatis a significant occurrence that
can trigger a state transition.can trigger a state transition.
UML defines three kinds of events.UML defines three kinds of events.
1.1. Signal eventSignal event caused by acaused by a
signal(exceptions)signal(exceptions)
2.2. Call eventCall event caused by an operationcaused by an operation
3.3. Time eventTime event caused by the expiry of acaused by the expiry of a
timer delay.timer delay.
State chart DiagramState chart Diagram
• AA guard conditionguard condition is a Boolean expressionis a Boolean expression
enclosed in square brackets. It isenclosed in square brackets. It is
evaluated only after the event hasevaluated only after the event has
occurred.occurred.
• AnAn actionaction is an executable atomicis an executable atomic
computation. An action cannot becomputation. An action cannot be
interrupted.interrupted.
Uml &amp; rup
State chart DiagramState chart Diagram
• Advanced StateAdvanced State
Using the basic features of the states andUsing the basic features of the states and
transitions in the UML we get thetransitions in the UML we get the FlatFlat
State MachinesState Machines which means a no. ofwhich means a no. of
arcs(transitions) and vertices(states).arcs(transitions) and vertices(states).
To manage the complexity, theTo manage the complexity, the AdvancedAdvanced
StatesStates are used.are used.
Faxing
Date=Current Date
Time=Fax Start Time
Phone No.=Owner Phone No.
Owner=Owner Name
Entry/key in remote fax no.
Exit/complete transmission
Do/ add date stamp
Do/time stamp
Do/add phone no.
Do/add owner
Do/ pull pages through
Do/paginate
Advanced
State
Entry and Exit Actions
An entry action is the first thing that occurs
each time an object enters a particular state.
An exit action is the last thing that occurs
each time an object leaves a particular state.
Tracking
entry/setMode(onTrack)
exit/setMode(offTrack)
Activities
An activity is an interruptible sequence of
actions that an object can perform while it
resides in a given state. (Actions are not
interruptible.)
Tracking
do/followTarget
Sub-states
Idle
Cooling
Heating
Activating
Active
Superstate
Substate
Sub-statesSub-states
• Sequential SubstatesSequential Substates
These substates occur one after theThese substates occur one after the
other.other.
Awaiting
User
Input
Registering
User Input
Visualizing
User
Input
Working
i/p
Sequential substates within the GUI’s Working state
Awaiting
User
Input
Registering
User Input
Visualizing
User
Input
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
i/p
Working
Watch
System
Clock
Update
Display
[is interval over]
Concurrent substates proceed at the same time.
A dotted line separates concurrent substates.
History StatesHistory States
Working
Screen
Saving
Keystroke or
Mouse movements[is Timeout]
Awaiting
User
Input
Registering
User Input
Visualizing
User
Input
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
i/p
Working
Watch
System
Clock
Update
Display
[is interval over]
H
Keystroke or mouse movement
[is TimeOut]
History States
History StatesHistory States
• Deep History StateDeep History State
If the history state remembers substates atIf the history state remembers substates at
all levels of nesting, then the history stateall levels of nesting, then the history state
isis deepdeep..
• Shallow History StateShallow History State
If the history state remembers only theIf the history state remembers only the
highest nested substate, the history statehighest nested substate, the history state
isis shallowshallow..
State chart DiagramState chart Diagram
• Case StudyCase Study
Draw the state-chart diagram for a fighter plane.Draw the state-chart diagram for a fighter plane.
The fighter plane has the warheads. It spots theThe fighter plane has the warheads. It spots the
targets using infrared imaging and fires air-to-airtargets using infrared imaging and fires air-to-air
missiles after locking the missile system with themissiles after locking the missile system with the
target. It camouflages the signaling while in thetarget. It camouflages the signaling while in the
range of an enemy radar and missile launchrange of an enemy radar and missile launch
system.system.
Activity DiagramActivity Diagram
• It is similar to a flow-chart.It is similar to a flow-chart.
Activity 2
Activity 1
Why Activity Diagrams?
An activity diagram, which resembles a
flowchart, is useful for modeling workflows
and the details of operations.
Activity DiagramActivity Diagram
• It consists of :It consists of :
1. Activity /Action1. Activity /Action
2. Transitions2. Transitions
Activity DiagramActivity Diagram
• ActivitiesActivities
These can be decomposed into activitiesThese can be decomposed into activities
or actions.or actions.
These are not atomic and can beThese are not atomic and can be
interrupted.interrupted.
They take considerable time to complete.They take considerable time to complete.
Activity DiagramActivity Diagram
• Actions :Actions :
Cannot be decomposed further.Cannot be decomposed further.
They are atomic.They are atomic.
They generally take small time forThey generally take small time for
execution.execution.
Example: some expression forExample: some expression for
computation likecomputation like
y=ax+cy=ax+c
State Diagram Carryovers
The following items are common to state
diagrams and activity diagrams:
• activities
• actions
• transitions
• initial/final states
• guard conditions
Bid plan
Do construction
Breaking Up Flows
alternate paths:
• branch
• merge
parallel flows:
• fork
• join
Branching
A branch has one incoming transition and two
or more outgoing transitions:
Charge credit
card
Hold in will-callMail tickets
[today  7 days before show] [today < 7 days before show]
Merging
A merge has two or more incoming transitions
and one outgoing transition:
Customer
sees show
Mail tickets Customer picks
up tickets
Forking
A fork represents the splitting of a single flow
of control into two or more concurrent flows
of control:
Receive order
Process orderLog order
Joining
A join represents the synchronization of two
or more flows of control into one sequential
flow of control:
Pay bill
Bill customerReceive product
Swimlanes
Swimlanes partition groups of activities based
on, for instance, business organizations:
Pay bill
Bill customerReceive product
Customer Billing

More Related Content

PPTX
Uml Diagrams for Web Developers
PPT
Object Oriented Analysis &amp; Design
PPT
Executable UML and SysML Workshop
PDF
UNIFIED MODELING LANGUAGE
PPTX
PPTX
Introduction to UML
PPTX
Introduction to the Unified Modeling Language (UML)
PDF
Domain Modeling
Uml Diagrams for Web Developers
Object Oriented Analysis &amp; Design
Executable UML and SysML Workshop
UNIFIED MODELING LANGUAGE
Introduction to UML
Introduction to the Unified Modeling Language (UML)
Domain Modeling

What's hot (20)

PDF
UML Diagrams- Unified Modeling Language Introduction
PPT
UML- Unified Modeling Language
PPT
PPTX
Uml with detail
PDF
Unified Modeling Language
PPTX
What is UML (Unified Modeling Language)?
PPT
Uml unified-modeling-language-presented by dileep
PPT
PPT
analysis and design with uml
PPT
Unified Modeling Language (UML)
PPTX
An introduction to uml
PPT
PPTX
Object oriented methodology & unified modeling language
PPT
Uml Omg Fundamental Certification 2
PPTX
UML and Software Modeling Tools.pptx
PPTX
An Automatic Approach to Translate Use Cases to Sequence Diagrams
PPTX
Class and object_diagram
PPTX
Uml Presentation
PDF
UML Diagrams- Unified Modeling Language Introduction
UML- Unified Modeling Language
Uml with detail
Unified Modeling Language
What is UML (Unified Modeling Language)?
Uml unified-modeling-language-presented by dileep
analysis and design with uml
Unified Modeling Language (UML)
An introduction to uml
Object oriented methodology & unified modeling language
Uml Omg Fundamental Certification 2
UML and Software Modeling Tools.pptx
An Automatic Approach to Translate Use Cases to Sequence Diagrams
Class and object_diagram
Uml Presentation
Ad

Viewers also liked (8)

PPT
Bai thuyet trinh cntt
PPTX
Home appliances control system
PDF
Agile Process Introduction
PPTX
RUP model
PPTX
Tourism in India (ppt)
PPTX
Tourism ppt
PPTX
Travel and tourism management it project ppt
PPTX
Presentation on tourism industry
Bai thuyet trinh cntt
Home appliances control system
Agile Process Introduction
RUP model
Tourism in India (ppt)
Tourism ppt
Travel and tourism management it project ppt
Presentation on tourism industry
Ad

Similar to Uml &amp; rup (20)

PPT
uml2-1214558329929112-8.ppt
PPT
Chapter 2-Unified Modeling Languagee.ppt
PPT
Chapter 2-Unified Modeling Languagee.ppt
PPT
PPT
Uml - An Overview
PPT
UML (Hemant rajak)
PPT
uml.ppt
PPTX
Unified Modeling Language
PPTX
1. introduction to uml
PPTX
Cs 1023 lec 10 uml (week 3)
PPT
Unified Modeling Language
PPT
08 class and sequence diagrams
PDF
Software Engineering Tools and Practices.pdf
PPT
umlpresentation-140519151641-phpapp02.ppt
PPT
SDA ClassDiagram.ppt
PDF
Design UML diagrams
PDF
Design UML diagrams
PPTX
Unified Modeling Language and Examples .pptx
PPTX
Introduction to Unified Modeling Language
uml2-1214558329929112-8.ppt
Chapter 2-Unified Modeling Languagee.ppt
Chapter 2-Unified Modeling Languagee.ppt
Uml - An Overview
UML (Hemant rajak)
uml.ppt
Unified Modeling Language
1. introduction to uml
Cs 1023 lec 10 uml (week 3)
Unified Modeling Language
08 class and sequence diagrams
Software Engineering Tools and Practices.pdf
umlpresentation-140519151641-phpapp02.ppt
SDA ClassDiagram.ppt
Design UML diagrams
Design UML diagrams
Unified Modeling Language and Examples .pptx
Introduction to Unified Modeling Language

More from ◄ vaquar khan ► ★✔ (11)

PPTX
Cloud native-microservices
PPTX
Microservice with OAuth2
PDF
vaquarkhan-jitterbit
PPT
PPT
PPTX
Differences between JMS and AMQP
PPTX
Rest overview briefing
PDF
PPTX
Dye and Yielding Plants M.P. Dr. Azra khan PH.D. Research Paper
Cloud native-microservices
Microservice with OAuth2
vaquarkhan-jitterbit
Differences between JMS and AMQP
Rest overview briefing
Dye and Yielding Plants M.P. Dr. Azra khan PH.D. Research Paper

Recently uploaded (20)

PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
Cloud computing and distributed systems.
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Empathic Computing: Creating Shared Understanding
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Per capita expenditure prediction using model stacking based on satellite ima...
“AI and Expert System Decision Support & Business Intelligence Systems”
Network Security Unit 5.pdf for BCA BBA.
Cloud computing and distributed systems.
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Chapter 3 Spatial Domain Image Processing.pdf
20250228 LYD VKU AI Blended-Learning.pptx
Empathic Computing: Creating Shared Understanding
Agricultural_Statistics_at_a_Glance_2022_0.pdf
NewMind AI Monthly Chronicles - July 2025
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Unlocking AI with Model Context Protocol (MCP)
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Understanding_Digital_Forensics_Presentation.pptx
The Rise and Fall of 3GPP – Time for a Sabbatical?

Uml &amp; rup

  • 1. UML & RUPUML & RUP Introduction toIntroduction to UMLUML Vaquar khanVaquar khan
  • 2. What is UML?What is UML? • We need to build models for Software-We need to build models for Software- intensive systems.intensive systems. • Just as there exists a common languageJust as there exists a common language for construction industry, electronics/for construction industry, electronics/ electrical industry; UML is a commonelectrical industry; UML is a common language for visual modeling in softwarelanguage for visual modeling in software industry.industry.
  • 3. What is UML?What is UML? • UML is appropriate for modeling systemsUML is appropriate for modeling systems ranging from enterprise informationranging from enterprise information systems to distributed web applicationssystems to distributed web applications and even to hard real time embeddedand even to hard real time embedded systems.systems. • UML is process independent(although itUML is process independent(although it optimally can be used for RUP.)optimally can be used for RUP.)
  • 4. What is UML?What is UML? • The UML is language forThe UML is language for visualizingvisualizing specifyingspecifying constructingconstructing documentingdocumenting the artifacts of a software intensive systemthe artifacts of a software intensive system
  • 5. What is UML?What is UML? • VisualizingVisualizing Explicit model facilitates communication.Explicit model facilitates communication. Some structures transcend what can beSome structures transcend what can be represented in programming languagerepresented in programming language Each symbol has well-defined semanticsEach symbol has well-defined semantics behind itbehind it
  • 6. What is UML?What is UML? SpecifyingSpecifying The UML addresses the specification of allThe UML addresses the specification of all important analysis, design, andimportant analysis, design, and implementation decisions.implementation decisions.
  • 7. What is UML?What is UML? ConstructingConstructing Forward engineering: generation of code fromForward engineering: generation of code from model into programming language.model into programming language. Reverse engineering: reconstructing model fromReverse engineering: reconstructing model from implementationimplementation Round-trip engineering: going both waysRound-trip engineering: going both ways
  • 8. What is UML?What is UML? DocumentingDocumenting Artifacts include:deliverables, such asArtifacts include:deliverables, such as requirements documents,functionalrequirements documents,functional specifications, and test plans.specifications, and test plans. materials that are critical in controlling, measuring,materials that are critical in controlling, measuring, and communicating about a system duringand communicating about a system during development and after deploymentdevelopment and after deployment
  • 9. Building blocks of UMLBuilding blocks of UML • ThingsThings(icons/symbols)(icons/symbols) • RelationshipsRelationships(among the things)(among the things) • Diagrams(Diagrams(combination of things andcombination of things and relationships)relationships) • Extensibility Mechanisms(Extensibility Mechanisms(extendextend vocabulary of UML)vocabulary of UML)
  • 10. Diagrams in UMLDiagrams in UML The following diagrams provide theThe following diagrams provide the staticstatic viewview of the system.of the system. Class DiagramClass Diagram Object DiagramObject Diagram Component DiagramComponent Diagram Deployment DiagramDeployment Diagram
  • 11. Diagrams in UMLDiagrams in UML The following diagrams provide theThe following diagrams provide the dynamicdynamic viewview of the system.of the system. Use case DiagramUse case Diagram Sequence DiagramSequence Diagram Collaboration DiagramCollaboration Diagram Statechart DiagramStatechart Diagram Activity DiagramActivity Diagram
  • 12. Diagrams in UMLDiagrams in UML • Class Diagrams represent the static structure inClass Diagrams represent the static structure in terms of classes and relationships.terms of classes and relationships. • Object Diagrams represent object and theirObject Diagrams represent object and their relationships.relationships. • Use case Diagrams represent the functions of aUse case Diagrams represent the functions of a system from the user’s point of view.system from the user’s point of view. • Sequence Diagrams represent interactionsSequence Diagrams represent interactions among the objects on time scaleamong the objects on time scale
  • 13. Diagrams in UMLDiagrams in UML • Collaboration Diagrams are a spatialCollaboration Diagrams are a spatial representation of objects, links and interactionsrepresentation of objects, links and interactions • Statechart Diagrams represent the behavior ofStatechart Diagrams represent the behavior of an object in terms of its state changes.an object in terms of its state changes. • Activity Diagrams represent the behavior of anActivity Diagrams represent the behavior of an operation as a set of actionsoperation as a set of actions
  • 14. Diagrams in UMLDiagrams in UML • Component Diagrams represent theComponent Diagrams represent the physical components of the application.physical components of the application. • Deployment Diagrams represent theDeployment Diagrams represent the deployment of the components ondeployment of the components on particular pieces of hardware.particular pieces of hardware.
  • 15. Class DiagramClass Diagram • A class is represented by a rectangle in UMLA class is represented by a rectangle in UML • Initial uppercase letterInitial uppercase letter • first letter of second word capitalized.first letter of second word capitalized. WashingMachine Icon for class
  • 16. Class DiagramClass Diagram • Classes can be grouped into aClasses can be grouped into a packagepackage • UML represents a package as a tabbed folder.UML represents a package as a tabbed folder. Household Appliances A UML package
  • 17. Class DiagramClass Diagram • AA classclass name with thename with the packagepackage name isname is called acalled a pathname.pathname. Household Appliances:: WashingMachine
  • 18. Class DiagramClass Diagram • AnAn attributeattribute is a property of a class.Itis a property of a class.It describes a range of values that thedescribes a range of values that the property may hold in objects(i.e.property may hold in objects(i.e. instances)of that class.instances)of that class.WashingMachine brandName modelName serialNumber capacity A class & its attributes
  • 19. Class DiagramClass Diagram • AnAn operationoperation is something that a class canis something that a class can do, or that you(or another class)can do todo, or that you(or another class)can do to a class.a class. WashingMachine brandName modelName serialNumber capacity addClothes() Removeclothes() addDetergent() turnOn()
  • 20. Class DiagramClass Diagram • VisibilityVisibility WashingMachine -brandName -modelName … +addClothes() +removeClothes() #turnOn() … -private +public #protected
  • 21. Class DiagramClass Diagram • ElidingEliding a class and use ofa class and use of ellipsisellipsis WashingMachine brandName ... ellipsis addClothes() ...
  • 22. Class DiagramClass Diagram • Use ofUse of stereotypesstereotypes WashingMachine <<id info>> brandName modelName serialNumber <<machine info>> capacity <<clothes related>> addClothes() stereotypes (can be used to organize a list of attributes or operations)
  • 23. Class DiagramClass Diagram • Use ofUse of constraintconstraint andand notesnotes WashingMachine brandName modelName serialNumber capacity addClothes() removeClothes() addDetergent() turnOn() {capacity=16 or 18 or 20 lb.} constraint Ref: Govt.std EV5-2241 for serial nos. note
  • 24. Class DiagramClass Diagram • InterfaceInterface An interface specifies the externally-visible operations of a class and/or component, and has no implementation of its own. An interface typically specifies only a limited part of the behavior of a class or component. notation interface iconic
  • 25. Class DiagramClass Diagram • Interface: expanded form representationInterface: expanded form representation using stereotype.using stereotype. <<interface>> ImageObserver
  • 26. Class DiagramClass Diagram • How to find classes?How to find classes? Classes represent the vocabulary of anClasses represent the vocabulary of an area of knowledge.Conversations with aarea of knowledge.Conversations with a client or an expert in that area revealsclient or an expert in that area reveals nouns that can become classes in anouns that can become classes in a model and verbs that can becomemodel and verbs that can become operations.operations.
  • 27. Class DiagramClass Diagram Class RelationshipsClass Relationships • AssociationAssociation • MultiplicityMultiplicity • AggregationAggregation • CompositionComposition • DependencyDependency • InheritanceInheritance
  • 28. Class DiagramClass Diagram • AssociationAssociation An association between a player and aAn association between a player and a teamteam Player Team Plays on
  • 29. Class DiagramClass Diagram • AssociationAssociation Serves {ordered} CustomerBank Teller Constraint on association
  • 30. Class DiagramClass Diagram • Association classAssociation class Person Company Employee Employer contract Role names Association class
  • 31. Class DiagramClass Diagram • MultiplicityMultiplicity Multiplicity denotes the no. of objects ofMultiplicity denotes the no. of objects of one class that can relate to one object ofone class that can relate to one object of an associated class.an associated class. Player Team Plays on5 1
  • 32. Class DiagramClass Diagram • CommonCommon multiplicitymultiplicity valuesvalues
  • 33. Class DiagramClass Diagram • AggregationAggregation If two classes share associationIf two classes share association relationship and one class can be said torelationship and one class can be said to bebe a part of thea part of the otherother, the relationship is, the relationship is called aggregation.called aggregation. Aggregation expresses a relationshipAggregation expresses a relationship between a ‘whole’ and its ‘ part’.between a ‘whole’ and its ‘ part’.
  • 35. Class DiagramClass Diagram • CompositionComposition Composition is a strong type ofComposition is a strong type of aggregation.Each component in aaggregation.Each component in a composite can belong to just one whole.composite can belong to just one whole. The composite is responsible for creationThe composite is responsible for creation or deletion of itsor deletion of its part.part. e.g. building and rooms, purchase ordere.g. building and rooms, purchase order and order line.and order line.
  • 36. Class DiagramClass Diagram Coffee Table Table Top Leg 41 1 Composition Delete the table and the legs and the top have no existence.
  • 37. Class DiagramClass Diagram • DependencyDependency When the behavior of one class dependsWhen the behavior of one class depends on the structure and behavior of anotheron the structure and behavior of another class, the relationship between them isclass, the relationship between them is called dependency.called dependency.
  • 38. Class DiagramClass Diagram • DependencyDependency If classes A and B do not share any of theIf classes A and B do not share any of the structural relationships (association,structural relationships (association, aggregation or composition) and class B isaggregation or composition) and class B is passed as an argument to a function ofpassed as an argument to a function of class A, then A is said to depend on B.class A, then A is said to depend on B.
  • 39. Class DiagramClass Diagram Course Scheduler add(c:Course) remove(c:Course) Course Window handleEvent(e:Event) draw() Event Dependency
  • 40. Class DiagramClass Diagram • InheritanceInheritance When the classes haveWhen the classes have is a kind ofis a kind of relationshiprelationship between them it is called inheritance.between them it is called inheritance. The inheritance is explained byThe inheritance is explained by GeneralizationGeneralization andand Specialization.Specialization. The classesThe classes having inheritance relationship arehaving inheritance relationship are parent and child classes.parent and child classes.
  • 41. Class DiagramClass Diagram Animal Amphibian Mammal Reptile Horse Inheritance
  • 42. A typical class diagramA typical class diagram
  • 43. Use Case DiagramUse Case Diagram • Use Case AnalysisUse Case Analysis A software is judged ‘successful’ by its users andA software is judged ‘successful’ by its users and not by developers.not by developers. Developers can deliver a successful softwareDevelopers can deliver a successful software only if they understand user requirements.only if they understand user requirements. User requirements consists of detailedUser requirements consists of detailed description of how they want to use the system.description of how they want to use the system.
  • 44. Use Case DiagramUse Case Diagram • What is a use case?What is a use case? A use case is a description of a system’sA use case is a description of a system’s behavior from a user’s standpoint.behavior from a user’s standpoint. It is a collection of scenarios aboutIt is a collection of scenarios about system’s use.system’s use. Use case A use case is shown as an ellipse
  • 45. Use Case DiagramUse Case Diagram • Example: How to find the use cases for aExample: How to find the use cases for a washing machine?washing machine? Ask the question: Why would a userAsk the question: Why would a user interact with the washing machine?interact with the washing machine? The answer will describe the functionalityThe answer will describe the functionality desired by the user. The verbs will givedesired by the user. The verbs will give us the use cases of the system.us the use cases of the system.
  • 46. Use Case DiagramUse Case Diagram The washing machine as a system will haveThe washing machine as a system will have following use cases.following use cases. Wash clothes Rinse clothes Dry clothes User
  • 47. Use Case DiagramUse Case Diagram • ActorActor An actor is anyone or anything thatAn actor is anyone or anything that interacts with the system being built.interacts with the system being built. While use cases describe anything that isWhile use cases describe anything that is inside the system scope, actors areinside the system scope, actors are anything that is outside the system scope.anything that is outside the system scope.
  • 48. Use Case DiagramUse Case Diagram • ActorActor An actor is shown as a stick figure.An actor is shown as a stick figure. Actor
  • 49. Use Case DiagramUse Case Diagram Use Case User Programmer Tester Architect Analyst understands implements verifies expresses designs
  • 50. Use Case DiagramUse Case Diagram • Scenarios for the use case ‘Wash clothes’Scenarios for the use case ‘Wash clothes’ Open flap Machine starts washingOpen flap Machine starts washing Add clothes If timer’s time is out,Add clothes If timer’s time is out, Add soap machine gives alarmAdd soap machine gives alarm Add waterAdd water Close flapClose flap Set modeSet mode Set TimerSet Timer This is the normal behavior of the machine
  • 51. Use Case DiagramUse Case Diagram • The behavior of the machine may change inThe behavior of the machine may change in exceptional cases.exceptional cases. e.g. how would machine respond ife.g. how would machine respond if -user overloads the machine-user overloads the machine -user forgets to disengage drainage pipe-user forgets to disengage drainage pipe -in the process of washing there is power-in the process of washing there is power failurefailure
  • 52. Use Case DiagramUse Case Diagram • When a use case is described there couldWhen a use case is described there could bebe many sets of sequences/events which canmany sets of sequences/events which can be categorized into-be categorized into- 1. Main Flow of events1. Main Flow of events 2. Alternate flow of events2. Alternate flow of events 3. Exceptional flow of events3. Exceptional flow of events
  • 53. Use Case DiagramUse Case Diagram • Primary and Secondary Use casesPrimary and Secondary Use cases A primary use case is a description of set ofA primary use case is a description of set of sequence of actions that a system (and actor)sequence of actions that a system (and actor) perform, that yields an observable result of valueperform, that yields an observable result of value to a particular actorto a particular actor e.g Wash clothes is a primary use case becausee.g Wash clothes is a primary use case because it returns the user, theit returns the user, the washedwashed clothes,clothes, anan observable result of value to the userobservable result of value to the user
  • 54. Use Case DiagramUse Case Diagram Open flap Machine starts washingOpen flap Machine starts washing Add clothes If timer’s time is out,Add clothes If timer’s time is out, Add soap machine gives alarmAdd soap machine gives alarm Add waterAdd water Close flapClose flap Set modeSet mode Set TimerSet Timer Load machine Secondary use case
  • 55. Use Case DiagramUse Case Diagram • Load machine doesn’t return a completeLoad machine doesn’t return a complete service of value.service of value. Hence it is a Secondary Use CaseHence it is a Secondary Use Case The secondary use case can be found byThe secondary use case can be found by capturing common scenarios in Use Casecapturing common scenarios in Use Case DescriptionsDescriptions
  • 56. Use case RelationshipsUse case Relationships <<include>>:<<include>>: <<include>> relationship shows a necessary<<include>> relationship shows a necessary connection between use cases.connection between use cases. The included use case can be identified in twoThe included use case can be identified in two ways.ways. 1.1. Included use case might be preexisting and inIncluded use case might be preexisting and in the development of another use case , thethe development of another use case , the same behavior is required.same behavior is required. 2.2. To pull the functionality out of the existing useTo pull the functionality out of the existing use cases to form a new use case.cases to form a new use case.
  • 57. Use case RelationshipsUse case Relationships To use the <<include>> relationship the use casesTo use the <<include>> relationship the use cases must conform to two constraints.:must conform to two constraints.: 1. The calling use case may only depend on the1. The calling use case may only depend on the result from the called use case. It can have noresult from the called use case. It can have no knowledge of the internal structure of the calledknowledge of the internal structure of the called use case.use case. 2. The calling use case must always require the2. The calling use case must always require the execution of the called use case. The use of theexecution of the called use case. The use of the called use case is unconditional.called use case is unconditional.
  • 58. Use case RelationshipsUse case Relationships The included use case can be calledThe included use case can be called independently by the actor.independently by the actor.
  • 59. Use Case DiagramUse Case Diagram • <<extend>><<extend>> • It is used to show an optional behavior forIt is used to show an optional behavior for a use case, which is required only undera use case, which is required only under certain conditions.certain conditions. • If two use cases are connected byIf two use cases are connected by extendextend relationship, one is invoked if somerelationship, one is invoked if some conditions occurs in another use case.conditions occurs in another use case.
  • 60. Use Case DiagramUse Case Diagram 1……………… 2……………… 3 …[condition] ……………… ……………… 20 …………… 1………… 2………… 3………… …………. …………. …………. 10………. False True Money Overdrawn Withdraw Money <<extend>>
  • 61. Use case RelationshipsUse case Relationships • Generalization / Inheritance :Generalization / Inheritance : • Use case B is said to be inherited from use case A if :Use case B is said to be inherited from use case A if : • 1.1. B is a specialized use case and A is more general oneB is a specialized use case and A is more general one • 2.2. The child use case (B) inherits the behavior sequenceThe child use case (B) inherits the behavior sequence of the parent (A) and may insert additional behavior into itof the parent (A) and may insert additional behavior into it • 3.3. B can be said to be ‘is a kind of‘ AB can be said to be ‘is a kind of‘ A
  • 62. Use case RelationshipsUse case Relationships • 1.1. Read cardRead card 1.1. Read cardRead card • 2.2. Get pin numberGet pin number 2.2. GetGet pin numberpin number • 3.3. Validate pin number 3.Validate pin number 3. Validate pinValidate pin numbernumber • 4.4. Get transaction 4.Get transaction 4. GetGet transactiontransaction • 5.5. Get amount 5.Get amount 5. Show balanceShow balance • 6.6. Dispense money 6.Dispense money 6. Eject cardEject card • 7 Print report7 Print report • 8.8. Eject cardEject card Perform Transaction Capturing commonality Withdraw money Display balance
  • 63. Enter the appropriate relationshipsEnter the appropriate relationships for the following use case diagram forfor the following use case diagram for ATMATM
  • 65. Use case Analysis : SummaryUse case Analysis : Summary 1.1. Find out possible users / actors for the systemsFind out possible users / actors for the systems for whom is the system developed? Who are thefor whom is the system developed? Who are the beneficiaries?beneficiaries? 2.2. Find out what fundamental services (Use Cases) the actors,Find out what fundamental services (Use Cases) the actors, expect from the systemexpect from the system -- why would an actor interact with the system ?-- why would an actor interact with the system ? 3.3. Depict the interactions between each actor and the servicesDepict the interactions between each actor and the services the actor expects from the systemthe actor expects from the system -- drawing a use case diagram-- drawing a use case diagram 4.4. Detail each use case in terms of scenarios / sequence ofDetail each use case in terms of scenarios / sequence of actions performed by actors and systemactions performed by actors and system -- develop use case documentation-- develop use case documentation 5.5. Find out relationships the various use cases may haveFind out relationships the various use cases may have
  • 66. Use Case realizationUse Case realization • Finding out key objects withFinding out key objects with responsibilitiesresponsibilities • Determining basic object interactionsDetermining basic object interactions • Finding classes & determining classFinding classes & determining class relationshipsrelationships
  • 67. Discovering ObjectsDiscovering Objects 1.1. Underline the nouns that occur in all the relevant useUnderline the nouns that occur in all the relevant use case scenarios.case scenarios. 2.2. Select the nouns / objects that might share theSelect the nouns / objects that might share the responsibilities.responsibilities. 3.3. List the basic responsibilities that the objects shouldList the basic responsibilities that the objects should share.share. 3.3. Match each object with well defined responsibilities.Match each object with well defined responsibilities. 4.4. Investigate if any conceptual objects are requiredInvestigate if any conceptual objects are required 5.5. Work out the (tentative) list of attributes and methodsWork out the (tentative) list of attributes and methods to be supported by these objects, based on theirto be supported by these objects, based on their responsibilitiesresponsibilities
  • 68. Types Of ObjectsTypes Of Objects Boundary Object Control Object Entity ObjectBoundary Object Control Object Entity Object Input from & output to Environment localized here Processing and flow of control localized here Storage of data localized here
  • 69. Objects in the systemObjects in the system Boundary ObjectsBoundary Objects Control ObjectsControl Objects EntityEntity ObjectsObjects Card Reader Transaction Manager AccountCard Reader Transaction Manager Account Display Validator TransactionDisplay Validator Transaction PrinterPrinter Boundary Control Entity Packages
  • 70. Interaction DiagramsInteraction Diagrams The interaction diagrams are designed to modelThe interaction diagrams are designed to model how the objects communicate in order tohow the objects communicate in order to accomplish the tasks within the operation of theaccomplish the tasks within the operation of the system.system. The interaction diagram provides a pathwayThe interaction diagram provides a pathway from the textual descriptions of behaviors in thefrom the textual descriptions of behaviors in the scenarios to the operations required by thescenarios to the operations required by the Class Diagram.Class Diagram.
  • 71. Interaction DiagramsInteraction Diagrams • Interaction diagrams can be modeled inInteraction diagrams can be modeled in two ways.two ways. 1. Sequence Diagram: showing time1. Sequence Diagram: showing time sequence of messages among thesequence of messages among the objects.objects. 2. Collaboration Diagram: presents a2. Collaboration Diagram: presents a structure oriented visualization.structure oriented visualization.
  • 72. Sequence DiagramSequence Diagram A sequence diagram is an interactionA sequence diagram is an interaction diagram that emphasizes the timediagram that emphasizes the time ordering of messages.ordering of messages. A lifeline is a vertical dashed line thatA lifeline is a vertical dashed line that represents the lifetime of an object.represents the lifetime of an object. A focus of control is a tall, thin rectangle thatA focus of control is a tall, thin rectangle that shows the period of time during which anshows the period of time during which an object is performing an action.object is performing an action.
  • 75. Sequence DiagramSequence Diagram • A sequence diagram is drawn with respectA sequence diagram is drawn with respect to a context such as System, Subsystemto a context such as System, Subsystem or a use case.or a use case. • Typically a sequence diagram will beTypically a sequence diagram will be drawn for a use case.drawn for a use case.
  • 76. Sequence DiagramSequence Diagram Steps for drawing a sequenceSteps for drawing a sequence diagram.diagram. 1.1. Identify the objects that take part in theIdentify the objects that take part in the realization of the use case.realization of the use case. 2.2. Place the objects on the diagram fromPlace the objects on the diagram from left to right.left to right. 3.3. Set the lifelines of the objects.Set the lifelines of the objects.
  • 77. Sequence DiagramSequence Diagram 4.4. Starting with the message that initiatesStarting with the message that initiates the interaction, layout each subsequentthe interaction, layout each subsequent messages from top to bottom betweenmessages from top to bottom between the lifelines.the lifelines. 5.5. Attach theAttach the notesnotes wherever necessary.wherever necessary.
  • 78. Sequence DiagramSequence Diagram • Types of messages:Types of messages: Synchronous message:Synchronous message: AA synchronous messagesynchronous message assumes that aassumes that a return is needed, so the sender waits forreturn is needed, so the sender waits for the return before proceeding with anythe return before proceeding with any other activity.other activity. A synchronous message is shown as a solidA synchronous message is shown as a solid arrow with a bold head.arrow with a bold head.
  • 79. Sequence DiagramSequence Diagram Asynchronous message:Asynchronous message: The sender just sends out the messageThe sender just sends out the message and does not wait for a response.and does not wait for a response. An asynchronous message is shown as aAn asynchronous message is shown as a solid arrow with a stick head.solid arrow with a stick head.
  • 80. Sequence DiagramSequence Diagram • Return Message:Return Message: A message that represent only the replyA message that represent only the reply to a message is called ato a message is called a return.return. A return is represented as a dashedA return is represented as a dashed arrow .arrow . -------------------
  • 81. Sequence DiagramSequence Diagram • Self-reference message:Self-reference message: When the sender and the receiver of theWhen the sender and the receiver of the message are the same object, it is calledmessage are the same object, it is called as a self-reference message.as a self-reference message.
  • 82. Collaboration DiagramCollaboration Diagram A collaboration diagram is an interactionA collaboration diagram is an interaction diagram that emphasizes the organizationdiagram that emphasizes the organization of the objects that participate in theof the objects that participate in the interaction.interaction. You may have sequence numbers toYou may have sequence numbers to indicate the time ordering of messages, toindicate the time ordering of messages, to one or more levels.one or more levels.
  • 85. Collaboration DiagramCollaboration Diagram Case StudyCase Study Convert the sequence diagram forConvert the sequence diagram for GetCoffeeGetCoffee into the collaborationinto the collaboration diagram.diagram.
  • 86. State MachinesState Machines • A state machine is a behavior that specifies theA state machine is a behavior that specifies the sequences of states an object goes throughsequences of states an object goes through during its lifetime in response to events, togetherduring its lifetime in response to events, together with its response to those events.with its response to those events. • A state machine is used to model the dynamicA state machine is used to model the dynamic aspects of a system. It is drawn to model theaspects of a system. It is drawn to model the lifetime of an instance of a class or a use caselifetime of an instance of a class or a use case or an entire system.or an entire system.
  • 87. State MachinesState Machines • A state machine can be visualized in twoA state machine can be visualized in two ways: by emphasizing the flow of controlways: by emphasizing the flow of control from activity to activity( by activityfrom activity to activity( by activity diagrams) or by emphasizing the potentialdiagrams) or by emphasizing the potential states of the objects and the transitionsstates of the objects and the transitions among those states (by state chartamong those states (by state chart diagrams)diagrams)
  • 88. State chart DiagramState chart Diagram • It is drawn to show the states of a singleIt is drawn to show the states of a single object or a subsystem.object or a subsystem. • It consists of different states of an objectIt consists of different states of an object triggered by different events and thetriggered by different events and the signals.signals. • It is especially useful in modeling reactiveIt is especially useful in modeling reactive systems.systems.
  • 89. State chart Diagram A state is a condition in which an object can reside during its lifetime while it satisfies some condition, performs an activity, or waits for an event. .
  • 90. StateState • The state icon appears as a rectangle withThe state icon appears as a rectangle with rounded corners and a name. It alsorounded corners and a name. It also contains a compartment for actions:contains a compartment for actions: Name State variables Activities
  • 91. Initial and Final States The initial state is the default starting place for a state machine. The final state indicates the completion of the state machine’s execution. Filled circle Bull’s eye
  • 92. State chart DiagramState chart Diagram • TransitionTransition A transition is a relationship between twoA transition is a relationship between two states indicating that an object in the firststates indicating that an object in the first state will perform certain actions and enterstate will perform certain actions and enter the second state when a specified eventthe second state when a specified event occurs and specified conditions areoccurs and specified conditions are satisfied.satisfied.
  • 93. State chart DiagramState chart Diagram • Parts of a transitionParts of a transition Idle Cooling Temprise[isSetVal]/startComp() event Guard condition action Source state Target state
  • 94. State chart DiagramState chart Diagram • AnAn eventevent is a significant occurrence thatis a significant occurrence that can trigger a state transition.can trigger a state transition. UML defines three kinds of events.UML defines three kinds of events. 1.1. Signal eventSignal event caused by acaused by a signal(exceptions)signal(exceptions) 2.2. Call eventCall event caused by an operationcaused by an operation 3.3. Time eventTime event caused by the expiry of acaused by the expiry of a timer delay.timer delay.
  • 95. State chart DiagramState chart Diagram • AA guard conditionguard condition is a Boolean expressionis a Boolean expression enclosed in square brackets. It isenclosed in square brackets. It is evaluated only after the event hasevaluated only after the event has occurred.occurred. • AnAn actionaction is an executable atomicis an executable atomic computation. An action cannot becomputation. An action cannot be interrupted.interrupted.
  • 97. State chart DiagramState chart Diagram • Advanced StateAdvanced State Using the basic features of the states andUsing the basic features of the states and transitions in the UML we get thetransitions in the UML we get the FlatFlat State MachinesState Machines which means a no. ofwhich means a no. of arcs(transitions) and vertices(states).arcs(transitions) and vertices(states). To manage the complexity, theTo manage the complexity, the AdvancedAdvanced StatesStates are used.are used.
  • 98. Faxing Date=Current Date Time=Fax Start Time Phone No.=Owner Phone No. Owner=Owner Name Entry/key in remote fax no. Exit/complete transmission Do/ add date stamp Do/time stamp Do/add phone no. Do/add owner Do/ pull pages through Do/paginate Advanced State
  • 99. Entry and Exit Actions An entry action is the first thing that occurs each time an object enters a particular state. An exit action is the last thing that occurs each time an object leaves a particular state. Tracking entry/setMode(onTrack) exit/setMode(offTrack)
  • 100. Activities An activity is an interruptible sequence of actions that an object can perform while it resides in a given state. (Actions are not interruptible.) Tracking do/followTarget
  • 102. Sub-statesSub-states • Sequential SubstatesSequential Substates These substates occur one after theThese substates occur one after the other.other. Awaiting User Input Registering User Input Visualizing User Input Working i/p Sequential substates within the GUI’s Working state
  • 103. Awaiting User Input Registering User Input Visualizing User Input _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ i/p Working Watch System Clock Update Display [is interval over] Concurrent substates proceed at the same time. A dotted line separates concurrent substates.
  • 105. Awaiting User Input Registering User Input Visualizing User Input _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ i/p Working Watch System Clock Update Display [is interval over] H Keystroke or mouse movement [is TimeOut] History States
  • 106. History StatesHistory States • Deep History StateDeep History State If the history state remembers substates atIf the history state remembers substates at all levels of nesting, then the history stateall levels of nesting, then the history state isis deepdeep.. • Shallow History StateShallow History State If the history state remembers only theIf the history state remembers only the highest nested substate, the history statehighest nested substate, the history state isis shallowshallow..
  • 107. State chart DiagramState chart Diagram • Case StudyCase Study Draw the state-chart diagram for a fighter plane.Draw the state-chart diagram for a fighter plane. The fighter plane has the warheads. It spots theThe fighter plane has the warheads. It spots the targets using infrared imaging and fires air-to-airtargets using infrared imaging and fires air-to-air missiles after locking the missile system with themissiles after locking the missile system with the target. It camouflages the signaling while in thetarget. It camouflages the signaling while in the range of an enemy radar and missile launchrange of an enemy radar and missile launch system.system.
  • 108. Activity DiagramActivity Diagram • It is similar to a flow-chart.It is similar to a flow-chart. Activity 2 Activity 1
  • 109. Why Activity Diagrams? An activity diagram, which resembles a flowchart, is useful for modeling workflows and the details of operations.
  • 110. Activity DiagramActivity Diagram • It consists of :It consists of : 1. Activity /Action1. Activity /Action 2. Transitions2. Transitions
  • 111. Activity DiagramActivity Diagram • ActivitiesActivities These can be decomposed into activitiesThese can be decomposed into activities or actions.or actions. These are not atomic and can beThese are not atomic and can be interrupted.interrupted. They take considerable time to complete.They take considerable time to complete.
  • 112. Activity DiagramActivity Diagram • Actions :Actions : Cannot be decomposed further.Cannot be decomposed further. They are atomic.They are atomic. They generally take small time forThey generally take small time for execution.execution. Example: some expression forExample: some expression for computation likecomputation like y=ax+cy=ax+c
  • 113. State Diagram Carryovers The following items are common to state diagrams and activity diagrams: • activities • actions • transitions • initial/final states • guard conditions Bid plan Do construction
  • 114. Breaking Up Flows alternate paths: • branch • merge parallel flows: • fork • join
  • 115. Branching A branch has one incoming transition and two or more outgoing transitions: Charge credit card Hold in will-callMail tickets [today  7 days before show] [today < 7 days before show]
  • 116. Merging A merge has two or more incoming transitions and one outgoing transition: Customer sees show Mail tickets Customer picks up tickets
  • 117. Forking A fork represents the splitting of a single flow of control into two or more concurrent flows of control: Receive order Process orderLog order
  • 118. Joining A join represents the synchronization of two or more flows of control into one sequential flow of control: Pay bill Bill customerReceive product
  • 119. Swimlanes Swimlanes partition groups of activities based on, for instance, business organizations: Pay bill Bill customerReceive product Customer Billing

Editor's Notes

  • #109: Activity diagrams provide a way to model the workflow of a business process. You can also use activity diagrams to model code-specific information such as a class operation. Activity diagrams are very similar to a flowchart because you can model a workflow from activity to activity. An activity diagram is basically a special case of a state machine in which most of the states are activities and most of the transitions are implicitly triggered by completion of the actions in the source activities. The main difference between activity diagrams and statecharts is activity diagrams are activity centric, while statecharts are state centric. An activity diagram is typically used for modeling the sequence of activities in a process, whereas a statechart is better suited to model the discrete stages of an object’s lifetime.