Академический Документы
Профессиональный Документы
Культура Документы
Clic
k to
DISCLAIMER
Abstraction Automation
MDA
Open
Standards
etc.
etc.
4 IBM Software Group |
Contents
3Q2004
Foundations
Foundations ofof OO
OO ((Nygaard,
Nygaard, Goldberg,
Goldberg, Meyer,
Meyer,
Stroustrup , Harel, Wirfs - Brock, Reenskaug
Stroustrup, Harel, Wirfs-Brock, Reenskaug,…),…)
1967
View 1 View 2
?
8 IBM Software Group |
UML Approach: Single Model
! Views are projections of a complete model
" Continuous integration of views with dynamic detection of
inconsistencies
View 1 View 2
Well-formedness
rules defined by the P2
UML metamodel Pn
P1 Mapping rules defined by
System the UML specification
model
modeledBy
system
system Computer
model Computer
model Model
Model
repository
repository
P2
P2
Pn
Pn
0110110 10110
P1
P1 modeledBy 0110110
10100 10110
0100111
0110110 10110
System
System
10100 0100111
0110110 10111
10100 0100111
0110110 10111
model
model 0110110 10111
“meaning”
“meaning” of
of the
the
model
model (semantics)
(semantics)
10 IBM Software Group |
The “4-Layer” Architecture
01011
<sawdust>
<sawdust>
01011
<2
<2 tons>
tons>
<lard>
<lard>
01011
Real Objects
<Ben&Jerry’s>
<Ben&Jerry’s> <5
<5 tons>
tons> (computer memory,
(M0)
run-time environment)
Customer
Customer CustomerOrder
CustomerOrder Model (M1)
id
id item
item (model repository)
quantity
quantity
«specifiedBy» «specifiedBy»
Class
Class Association
Association ... Meta-Model (M2 = UML,
(modeling tool) CWM)
«specifiedBy»
Class(MOF)
Class(MOF) ... Meta-Meta-Model (M3 = MOF)
(modeling tool)
Real-Time UML
Real-Time UML for EDOC …..etc.
Complete
Complete Level
Level
State Structured Activities Interactions Flows
Detailed
Machines Classes and
Actions
Components
Intermediate
Intermediate Level
Level
MOF Profiles OCL
Basic
Basic Level
Level
Basic UML
(Classes, Basic behavior, Internal structure, Use cases…)
UML Infrastructure
UML
UML Superstructure
Superstructure
MOF
MOF “Superstructure”
“Superstructure”
UML
UML «import»
«import» MOF
MOF
Infrastructure
Infrastructure
Library
Library
«import»
«import»
Extended
Extended notion
notion
of
of Class,
Class,
Association,
Association, «import»
«import»
Constructs
Constructs Profiles
Profiles
0..* 0..*
Company Person
employer employee
C2 P2
P2
C2
C1
C1 P3
P3
Set: employee(s) of C1
s2
s2
s1
s1
company accounts
Corporate
Corporate Corporate
Corporate
Customer
Customer 1 * Account
Account
{subsets {subsets
owner} accounts}
Private owner accounts Private
Private Private
Customer
Customer 1 0..5 Account
Account
{subsets {subsets
owner} accounts}
Namespace
Namespace
Element Classifiers
Classifiers
Element
Namespace
Namespace
NamedElement
NamedElement
name
name :: String
String NamedElement
NamedElement Classifier
Classifier
«import»
Feature
Feature
Namespace
Namespace
32 IBM Software Group |
Kinds of Classifiers
! The following are kinds of ! Kinds of Behavior
Classifier in UML 2.0: " Activity
" Association (including " Interaction
AssociationClass)
" State Machine
" Class (including structured
classes) " Protocol State Machine
" Component
" Collaboration
" Interface
" Data Type
" Use Case
" Signal
" Behavior !
" etc.
33 IBM Software Group |
Infrastructure: Consolidation of Concepts
! The re-factoring of the UML metamodel into fine-grained
independent concepts
" Eliminates semantic overlap
" Provides a better foundation for a precise definition of
concepts and their semantics
" Conducive to MDD
Library
Library
Customer
Customer
1
*
Customer
Customer Account
Account
name:
name: String
String
name:
name: String
String
1
*
Customer
Customer Account
Account
name:
name: String
String
«merge»
Extend
Extend
Customer
Customer
age:
age: Integer
Integer
Infrastructure
Infrastructure
Library
Library UML
UML
«merge» 0..1
*
Class
Class Class
Class Behavior
Behavior
MOF
MOF
«merge»
Class
Class
xmi
xmi (( ))
37 IBM Software Group |
UML 2.0: Run-Time Semantics
Activities
State
Machines ...
Interactions
ActionSemantics
(Communications)
owningInstance owningSlot
InstanceSpecification Va lueS pe ci fic at ion
{subsets owner} slot * {subsets owner} val ue
Slot (from Expres sions)
1 {subsets {ordered,
0..1 *
ownedElement} subsets
ownedElement}
StructuralFeature
definingFeature (from StructuralFeatures)
classifier
Classifier
1..* (from Classifiers)
inst ance 1
ValueSpecification
(from Expressions)
Object
Object Identifier
Identifier
InstanceValue
Obj1 Obj2
Object
behavior
s1 s1 (e.g., statechart)
s2 s2
Obj3
s1
s2
Inter-
Inter-object
behavior
(interaction)
41 IBM Software Group |
How Things Happen in UML
! An action is executed by an object
" May change the contents of one or more variables or slots
" If it is a communication (“messaging”) action, it may:
• Invoke an operation on another object
• Send a signal to another object
• Either one will eventually cause the execution of a procedure on the
target object…
• …which will cause other actions to be executed, etc.
" Successor actions are executed
• Determined either by control flow or data flow
AnActiveClass
Shared
Shared Behavior
Behavior
Semantics
Semantics
Different
Different Behavior
Behavior
Formalisms
Formalisms Common
Common
Behaviors
Behaviors
Activities
Activities Interactions
Interactions StateMachines
StateMachines UseCases
UseCases
Actions
Actions
44 IBM Software Group |
Common Behavior Metamodel
! The “classifier behavior” of a composite classifier is distinct from
the behavior of its parts (i.e., it is NOT a resultant behavior)
Classifier Class
(from Kernel)
(f ro m Ke rne l)
0..1 +ownedBehavior *
BehavioredClassifier Behavior 0..1 +parameter *
+context {subsets Parameter
isReentrant : Boolean
ownedMember} {ordered, subsets
ownedMember}
0..1 +classifierBehavior 0..1
{subsets
ownedBehavior}
+/returnResult
+specification +method * 0..1 {ordered} *
BehavioralFeature
isAbstract : Boolean 0..1
. .
.
Action2
Action2 .
.
. .
.
. .
. .
.
Action1
Action1 .
.
.
. . .
.
.
.
Action3
Action3 .
.
Input Pin
(typed) VariableA
VariableA
Data Flow
«precondition»
«precondition»
{port.state
{port.state >> 0}
0}
for( int ii == 0;
for(int 0; ii <s)
<s)
portP->send ((sig)
portP->send sig)
ia [i] == i++;
ia[i] i++;
««postcondition»
postcondition»
{port.state alternatives
alternatives
{port.state >> 1}
1}
sig
on portP
Order
cancel Cancel
request
Input order
pin
Ship
Receive Fill Close
Order order
order order order
A1 A2 A4 A5
A3
Seattle
Seattle Reno
Reno
OrderDepartment
Ship
Ship
Receive
Receive Fill
Fill Close
Close
order
order
order
order order
order order
order
Company
Accounting
Send
Send Accept
Accept
invoice
invoice payment
payment
Invoice
Invoice
Customer
Make
Make
payment
payment
Activity
Activity or
or Action
Action
Control
Control Join
Join
Object
Object Node
Node
(may
(may include
include state)
state) Initial
Initial Node
Node
Pin
Pin (Object)
(Object)
Activity
Activity Final
Final
Choice
Choice
Flow
Flow Final
Final
(Simple)
(Simple) Join
Join
57 IBM Software Group |
Extended Concurrency Model
! Fully independent concurrent streams (“tokens”)
Concurrency
Concurrency fork
fork Concurrency
Concurrency join
join
B C
A Z
X Y
NB:
NB: Not
Not part
part of
of the
the
notation
notation
Activity 2 Activity 3
sd ATM-transaction Interaction
Interaction Occurrence
Occurrence
ref
CheckPin client: atm: dbase:
askForPIN
alt [chk= OK] data(PIN)
check(PIN)
ref
DoTransaction result(chk)
result(chk)
[else]
error(badPIN)
Combined
Combined (in-line)
(in-line)
Fragment
Fragment
sd sd
SB_GoHomeSetup SB_Authorization
sd GoHomeSetup
:Central :Authorizer
:ServiceBase
:ServiceUser :ServiceTerminal
ref SB_GoHomeSetup
:TimeKeeper
ref
Authorization
sd SB_GoHomeSetup
opt
SetHome
ref SB_Authorization
SetInvocationTime
opt
SetTransportPreferences
SetHome
Decomposition
Decomposition with
with SetInvocationTime
global constructs
global constructs
corresponding
corresponding toto SetTransportPreferences
those
those on
on decomposed
decomposed
lifeline
lifeline
63 IBM Software Group |
Combined Fragments and Data
sd GoHomeInvocation(Time invoc)
TransportSchedule
Choice
Choice
loop
alt
[Now>interv+last]
Operand
Operand
ScheduleIntervalElapsed
FindLocation
Separator
Separator TransportSchedule
[pos-lastpos>dist]
GetTransportSchedule
TransportSchedule
FetchSchedule
Guarding
Guarding Data
Data
Constraint
Constraint
64 IBM Software Group |
Combined Fragment Types (1 of 2)
! Alternatives (alt)
" choice of behaviors – at most one will execute
" depends on the value of the guard (“else” guard supported)
! Option (opt)
" Special case of alternative
! Break (break)
" Represents an alternative that is executed instead of the remainder of
the fragment (like a break in a loop)
! Parallel (par)
" Concurrent (interleaved) sub-scenarios
! Negative (neg)
" Identifies sequences that must not occur
sd
:Client :Server
request
~[more]
[more]
ref
DoMore
t=0 t=5 t = 10 t = 15
sd Reader {d..d+0.5}
Reading
r : Reader Idle
Read ReadDone Read
{t1..t1+0.1}
Uninitialized
Initialize Event
Event
Occurrence
Occurrence
t1
Observation
Observation
69 IBM Software Group |
Sidebar: Information Flows
! For specifying kinds of information that are exchanged between
elements of the system – at a very abstract level
" Do not specify details of the information (e.g., type)
" Do not specify how the information is relayed
" Do not specify the relative ordering of information flows
Customer
Customer «flow» «flow» Employee
Employee
product wages
Company
Company
N2:Node
N2:Node
N1:Node
N1:Node N3:Node 0..1
N3:Node Node
Node
right
N4:Node
N4:Node
left 0..1
RedundantSystem
role
role associated
interaction primary
primary
get
2 a
1query 2b get
arbiter
arbiter
client
client backup1
backup1
::Arb
Arb 2c
ge
t
connector
connector
(link
(link role)
role) backup2
backup2
d1 /primary
d1/primary
:Dbase
:Dbase
c1 /client
c1/client aa/arbiter
/arbiter d2 /backup1
d2/backup1
::Cl
Cl ::Arb
Arb :Dbase
:Dbase
d2 /backup2
d2/backup2
:Dbase
:Dbase
a:Arb
a:Arb collaboration
collaboration
occurrence
occurrence
arbiter
client
c1:Cl
c1:Cl rs1:RedundantSystem d1:Dbase
d1:Dbase
primary
backup1 backup2
d2:Dbase
d2:Dbase
FaxSender FaxReceiver
sd sd FaxSender FaxReceiver
EndCall
EndCall StartCall
StartCall
Call
AckCall (parms)
CallParms(par)
««interface»
interface»
interface»
««interface»
interface»
interface» FaxReceiver
FaxReceiver loop Data
FaxSender
FaxSender AckData
Call()
Call()
AckCall(par)
AckCall(par)
AckCall(par) CallParms(
CallParms(( ))
CallParms
AckData(
AckData(( ))
AckData Data()
Data()
AckHangup(
AckHangup(( ))
AckHangup Hangup(
Hangup(( ))
Hangup
Fax
Fax Fax
Fax
Sender
Sender Receiver
Receiver
e.g.,
e.g., Database
Database Admin
Admin port
port
e.g.,
e.g., Database
Database User
User ports
ports
objC objF
void E () {…
E() pp objM.setA(d)
q.setA(d) qq objG
…
objM
MasterIF
MasterIF
c: ClassX
c:ClassX
SlaveIF
SlaveIF
remote
remote remote
remote
sender
sender :: Fax
Fax receiver
receiver :: Fax
Fax
FaxSender FaxReceiver
:FaxProtocol
cc cc
remote
remote
sender:Fax
sender:Fax receiver:Fax
receiver:Fax
remote
remote
FaxCall
FaxCall
Part
Part
83 IBM Software Group |
Structure Refinement Through Inheritance
! Using standard inheritance mechanism (design by
difference)
sender:Fax
sender:Fax receiver:Fax
receiver:Fax
ProductArchitecture
mgr:FaxMgr
mgr:FaxMgr
mgr:FaxMgr
ProductA ProductB
0..1 0..1
Packageable
Packageable
*
Component
*
Realization
Element Component Realization
Element
1
Class
Class
ReadAmountSM
abort
EXIT
EXIT point
point
otherAmount
selectAmount
amount
abort
EnterAmount
aborted
ok
again
ENTRY
ENTRY point
point
89 IBM Software Group |
Modular Submachines: Usage
invoked
invoked
submachine
submachine
ATM
VerifyCard
acceptCard
outOfService
ReadAmount : aborted
OutOfService ReadAmountSM
again usage
usage of
of
exit
exit point
point
rejectTransaction
releaseCard
VerifyTransaction ReleaseCard
usage
usage of
of
entry
entry point
point
ATM Behaviour
Statemachine
acceptCard()
outOfService()
amount()
<<Redefine>>
FlexibleATM Behaviour
Statemachine
otherAmount()
rejectTransaction()
ATM
VerifyCard
{final}
acceptCard
ReadAmount
OutOfService
outOfService selectAmount
{final} amount
releaseCard
VerifyTransaction ReleaseCard
{final} {final}
ATM {extended}
FlexibleATM VerifyCard
{final}
acceptCard
ReadAmount {extended}
otherAmount
OutOfService
outOfService selectAmount
{final} amount enterAmount
reject ok
releaseCard
VerifyTransaction ReleaseCard
{final} {final}
ready ( )
Landed Ready
land ( )
[cleared]
takeOff ( ) / [gearRetracted]
Flying
Equivalent to pre and post conditions
added to the related operations:
takeOff()
Pre
-in state ”Ready"
-cleared for take off
Post
-landing gear is retracted
-in state ”Flying"
94 IBM Software Group |
Notational Enhancements
! Alternative transition ! State lists
notation
Idle
[ID<=10] [ID>10]
Is a notational shorthand for
MinorReq=Id; MajorReq=Id;
VerifyCard logCard
Busy
95 IBM Software Group |
Contents
Standard
Standard UML
UML Semantics
Semantics
Heavyweight
Heavyweight Lightweight
Lightweight
extension
extension M
M extension
extension
Integer «clock»
«clock» Stereotype
Stereotype of
of Class
Class
with
with added
added semantics:
semantics:
an
an active
active counter
counter whose
whose
value
value changes
changes
synchronously
synchronously with
with the
the
progress
progress of
of physical
physical time
time
«clock» Stereotype-specific
Stereotype-specific attribute
attribute
MyClockClass
{resolution = 500 ns}
SetTime( )
appliedProfile
Package ProfileApplication Class /metaclass /extension Extens ion ownedEnd ExtensionEnd
{subsets packageImport}
/ isRequired : Boolean
1 1 / * 1 1
*
* *
importedProfile
Profile
1 {subsets importedPackage}
St ereotype type
ownedStereotype
1
1 {subsets ownedMember} *
metaclassReference
ElementImport
(from Constructs)
0.. 1 {subsets elementImport} *
metamodelReference PackageImport
(from Constructs)
0.. 1 {subsets packageImport} *
Extension
Extension
«profile»
«profile» SimpleEJB
SimpleEJB
«metaclass»
«metaclass» «stereotype»
«stereotype»
Component
Component Bean
Bean
«stereotype»
«stereotype» «stereotype»
«stereotype»
Entity
Entity Session
Session
Class(ifier)
template «bind» <T -> Integer, k -> 10> “Bound”
class
IntegerArray
arrayElement : Integer [10]
102 IBM Software Group |
Collaboration Templates
! Useful for capturing design patterns
ObserverPattern
oType, sType
Collaboration
template
«bind»
DeviceObserver