Professional Documents
Culture Documents
Lecture on
At
On
02- July-2010
by
N V Ganapathi Raju
Associate Professor,GRIET,Hyderabad
OOAD 1
UML
O O Philosophy
OOAD 2
UML
Survey of Methodologies
OOAD 3
UML
OOAD 4
UML
Why do we model?
Provide structure for problem solving
Experiment to explore multiple solutions
Furnish abstractions to manage complexity
Reduce time-to-market for business problem solutions
Decrease development costs
Manage the risk of mistakes
The UML is a graphical
language for
specifying
visualizing
constructing
documenting
OOAD 5
UML
OOAD 6
UML
OOAD 7
UML
Building Blocks
OOAD 8
UML
UML Concepts and Notation1
UML
OOAD 9
UML
Modeling Elements
Structural elements
class,
interface, collaboration, use case, active class, component
Behavioral elements
interaction, state machine
Grouping elements
package, subsystem
Other elements
note
OOAD 10
UML
Structural Elements
OOAD 11
UML
Class
OOAD 12
UML
Interface
OOAD 13
UML
Collaboration
OOAD 14
UML
Use Case
OOAD 15
UML
Active Class
OOAD 16
UML
Component
OOAD 17
UML
Node
OOAD 18
UML
Behavioral Elements
OOAD 19
UML
Interaction
OOAD 20
UML
State Machine
OOAD 21
UML
Package
OOAD 22
UML
Note
OOAD 23
UML
Relationships
Dependency
Association
Generalization
Realization
OOAD 24
UML
UML Concepts and Notation
Class Active Class Package Component
Name Name Name
Attributes Attributes
(private) (private)
Operations Operations
(public) (public)
Respon- Respon-
sibilities sibilities
(public) (public)
Analysis Analysis Analysis
Entity Class Boundary Class Control Class
Use case Actor
Action
Relationships
Association
Note Dependency or Flow
Realization
Textual Generalization
content Composition
Aggregation
OOAD 25
UML
Dependency
OOAD 26
UML
Association
OOAD 27
UML
OOAD 28
UML
Association
• A link between two classes
• Name
• Multiplicities
Employee Department
Association Multiplicity
1 : Necessary
0..1 : Optional
0..* or * : Unspecified
1..* : One or more
1..n : between 1 and n
n,m,l : n, m or l
OOAD 30
UML
Qualified association
* 0..1
Bank Person
Account
number
OOAD 31
UML
Associations
TarifSchedule TripLeg
Enumeration
getZones() price
Price
* * zone
many-to-many
getPrice(Zone)
Polygon Point
1 *
1-to-many x:Integer
draw() y:Integer
OOAD 32
UML
Aggregation
(special case of association)
Exhaust System
1 0..2
Muffler Tailpipe
OOAD 33
UML
OOAD 34
UML
Composition
TicketMachine
3
ZoneButton
OOAD 35
UML
OOAD 36
UML
Generalization
OOAD 37
UML
OOAD 38
UML
OOAD 39
UML
Realization
OOAD 40
UML
OOAD 41
UML
Visibility
• Each contained element has a visibility relative to
the containing package
– A public element is visible to elements outside the
package, denoted by ‘+’
– A protected element is visible only to elements within
inheriting packages, denoted by ‘#’
– A private element is not visible at all to elements
outside the package, denoted by ‘-’
• Same syntax for visibility of attributes and
operations in classes
OOAD 42
UML
Extensibility Mechanisms
OOAD 43
UML
DIAGRAMS
OOAD 44
UML
Diagrams
Class
Diagrams
Use Case
Diagrams Object
Sequence Diagrams
Diagrams
Statechart Deployment
Diagrams Diagrams
Activity
Diagrams
OOAD 45
UML
Views
OOAD 46
UML
Class Diagram
Shows a set of classes, interfaces and collaborations, and their
relationships.
Address static design view of a system
Class diagrams are used
during requirements analysis to model problem domain concepts
during system design to model subsystems and interfaces
during object design to model classes.
Purpose
Name and model concepts in the system
Specify logical database schemas
Rrepresent the structure of the system.
OOAD 47
UML
Class Diagrams
TariffSchedule
Table zone2price Name
Enumeration getZones()
Signature Price getPrice(Zone)
Class
Multiplicity SimpleWatch Association
1 1 1 1
2 1 2 1
PushButton LCDDisplay Battery Time
state blinkIdx load() now()
push() blinkSeconds(
release() )
blinkMinutes(
) Attributes
blinkHours()
stopBlinking(
) Operations
OOAD referesh()
48
UML
Object Diagram
Built during analysis and design
Purpose
Illustrate
data/object structures
Specify snapshots
Captures instances and links
OOAD 49
UML
Object Diagram
OOAD 50
UML
Actor
ReadTime
SetTime
WatchUser WatchRepairPerson
Use case
ChangeBattery
OOAD 51
UML
Actors
OOAD 52
UML
Use Case
Shows a set of actors and use cases, and their relationships
OOAD 53
UML
Purpose
Specify the context of a system
Capture the requirements of a system
Validate a system’s architecture
Drive implementation and generate test cases
OOAD 54
UML
Transfer Money
OOAD 55
UML
OOAD 56
UML
Exceptional cases!
OOAD 57
UML
Sequence Diagram
shows interactions consisting of a set of objects and the messages sent
and received by those objects.
Used during requirements analysis
To refine use case descriptions
to find additional objects (participating objects)
Used during system design
to refine subsystem interfaces
Classes are represented by columns
Messages are represented by arrows
Activations are represented by narrow rectangles to sent the message,
and is as long as all nested activations
Lifelines are represented by dashed lines
Purpose
Captures dynamic behavior (time-oriented) in terms of interactions.
Model flow of control
Illustrate typical scenarios
Complement the class diagrams which represent structure.
OOAD 58
UML
Sequence Diagram
Objec
t
:SimpleWatch :LCDDisplay :Time
:WatchUser
pressButton1() blinkHours()
pressButton1() blinkMinutes()
pressButton2() incrementMinutes()
refresh()
pressButtons1And2()
commitNewTime()
stopBlinking()
Message
Activation
OOAD 59
UML
Sequence Diagram
OOAD 60
UML
Collaboration Diagram
OOAD 61
UML
Collaboration Diagram contd..
Captures dynamic behavior (message-oriented)
Purpose
Model flow of control
Illustrate coordination of object structure and control
OOAD 62
UML
Activity Diagrams
Shows control/data flows from one activity to another
Emphasizes the flow of control among objects
Purpose
Model business workflows, flow control within a system, and
operations
Captures dynamic behavior (activity-oriented)
OOAD 64
UML
Splitting Synchronization
Allocate
Resources
Document
Incident
OOAD 65
UML
Dispatcher
Allocate
Resources
FieldOfficer
Document
Incident
OOAD 66
UML
Statechart Diagram
Shows a state machine consisting of states, transitions, events , and
activities
Purpose
Model object lifecycle
Model reactive objects (user interfaces, devices, etc.)
OOAD 67
UML
Statechart Diagrams
Initial State
Event
state
button2Pressed
button1&2Pressed Blink Increment
Hours Hours
Transition button1Pressed
button1&2Pressed button2Pressed
Blink Increment
Minutes Minutes
button1Pressed
button2Pressed
Stop Blink Increment
Blinking Seconds Seconds
button1&2Pressed
Final state
OOAD 68
UML
Component Diagram
Purpose
Organize source code
Construct an executable release
Specify a physical database
OOAD 69
UML
Component Diagram
OOAD 70
UML
Deployment Diagram
Purpose
Specify the distribution of components
Identify performance bottlenecks
OOAD 71
UML
Deployment Diagram
OOAD 72
UML
OOAD 73
UML
Conceptual Physical
OOAD 74
UML
OOAD 75
UML
the static aspects of this view are captured in class diagrams and
object diagrams;
the dynamic aspects of this view are captured in interaction
diagrams, state-chart diagrams, and activity diagrams.
OOAD 76
UML
the static and dynamic aspects of this view are captured in the
same kinds of diagrams as for the design view, but with a focus on
the active classes that represent these threads and processes.
OOAD 77
UML
OOAD 78
UML
OOAD 79
UML
Selecting a View
If you are modeling a simple monolithic application that runs on a
single machine then:
use case view: use case diagrams
design view: class, interaction diagrams
process view: None required
implementation view: None required
Deployment view: None required
OOAD 80
UML
END
OOAD 81