46
IBM Software Group ® Applying UML 2 to Model-Driven Architecture Version 2.0 2003-10-17 John Hogg Kanata, Ontario, Canada

Applying UML 2 to Model-Driven Architecture · S2 Outgoing interface (protocols) Incoming interface (protocols) IBM Software Group | Rational software 15 Connecting Ports! Ports can

  • Upload
    others

  • View
    9

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Applying UML 2 to Model-Driven Architecture · S2 Outgoing interface (protocols) Incoming interface (protocols) IBM Software Group | Rational software 15 Connecting Ports! Ports can

IBM Software Group

®

Applying UML 2 to Model-Driven Architecture

Version 2.0 2003-10-17

John HoggKanata, Ontario, Canada

Page 2: Applying UML 2 to Model-Driven Architecture · S2 Outgoing interface (protocols) Incoming interface (protocols) IBM Software Group | Rational software 15 Connecting Ports! Ports can

IBM Software Group | Rational software

22

Agenda

! Introduction! UML 2 Structuring Concepts! Applying the Concepts

!Scalable Modelling!Code Generation!Model-Driven Testing!Thread Assignment

! Conclusion

Page 3: Applying UML 2 to Model-Driven Architecture · S2 Outgoing interface (protocols) Incoming interface (protocols) IBM Software Group | Rational software 15 Connecting Ports! Ports can

IBM Software Group | Rational software

33

Introduction

! UML 2 is most important release since the original UML 1.1! Most significant areas of change for users are

! Classes with structure! Sequence diagrams! Activity diagrams

! Classes with structure go beyond useful aids to understanding

! When properly applied, their value spans much of model-driven architecture

! We’ll see how…

Page 4: Applying UML 2 to Model-Driven Architecture · S2 Outgoing interface (protocols) Incoming interface (protocols) IBM Software Group | Rational software 15 Connecting Ports! Ports can

IBM Software Group | Rational software

44

Agenda

! Introduction! UML 2 Structuring Concepts! Applying the Concepts

!Scalable Modelling!Code Generation!Model-Driven Testing!Thread Assignment

! Conclusion

Page 5: Applying UML 2 to Model-Driven Architecture · S2 Outgoing interface (protocols) Incoming interface (protocols) IBM Software Group | Rational software 15 Connecting Ports! Ports can

IBM Software Group | Rational software

55

Challenges: Scalable Architectures and Environments

! Application must evolve without loss of architecture! Understandable, maintainable code! Reusable, reconfigurable code

! Environment must support team development! Avoidance of development conflicts/bottlenecks! Minimal build times

! These issues apply to all but the smallest development teams

! How to achieve scalable, maintainable architectures?

Page 6: Applying UML 2 to Model-Driven Architecture · S2 Outgoing interface (protocols) Incoming interface (protocols) IBM Software Group | Rational software 15 Connecting Ports! Ports can

IBM Software Group | Rational software

66

Representing Architecture As Structure Models

! Solution: decouple the architecture from the class building blocks

! “Architecture” is who speaks to whom and what they say! Defined using UML 2.0 “classes with structure”

! Based on “role modelling” of ROOM, OORAM, UML-RT

/ buyer : Person

/ seller : Person

/ buyer : Person

/ seller : Person

Page 7: Applying UML 2 to Model-Driven Architecture · S2 Outgoing interface (protocols) Incoming interface (protocols) IBM Software Group | Rational software 15 Connecting Ports! Ports can

IBM Software Group | Rational software

77

/ seller : Perso n

/ buyer : Perso n

/ buyerAccount : Account

/ sellerAccount : Account

Structure Modelling Is Not Class Modelling

! Transaction example:!Two Persons!Each Person has an Account!Who owns which Account?

????

Transaction

Account buyerAccountsellerAccount

Person

seller buyer

account

buyer

seller

Page 8: Applying UML 2 to Model-Driven Architecture · S2 Outgoing interface (protocols) Incoming interface (protocols) IBM Software Group | Rational software 15 Connecting Ports! Ports can

IBM Software Group | Rational software

88

Structure Modelling Is Not Class Modelling

! Transaction example:!Two Persons!Each Person has an Account!Who owns which Account?

Transaction

Account buyerAccountsellerAccount

Person

seller buyer

account

buyer

seller

/ seller : Person

/ buyer : Person

/ buyerAccount : Account

/ sellerAccount : Account

????

Page 9: Applying UML 2 to Model-Driven Architecture · S2 Outgoing interface (protocols) Incoming interface (protocols) IBM Software Group | Rational software 15 Connecting Ports! Ports can

IBM Software Group | Rational software

99

Structure Modelling Is Not Class Modelling

! Transaction example:!Two Persons!Each Person has an Account!Who owns which Account?

Transaction

Account buyerAccountsellerAccount

Person

seller buyer

account

buyer

seller

! Class models show “for all” properties

! Structure models show architectural relationships

/ seller : Person

/ buyer : Person

/ buyerAccount : Account

/ sellerAccount : Account

!!!!

Page 10: Applying UML 2 to Model-Driven Architecture · S2 Outgoing interface (protocols) Incoming interface (protocols) IBM Software Group | Rational software 15 Connecting Ports! Ports can

IBM Software Group | Rational software

1010

Structure Modelling Is Not Object Modelling! Object models show completely reified

objects !Angus and Bruce are not reusable

! Object models are examples,not architectures

/ Angus : Person

/ Bruce : P erson

/ AngusAccount : Account

/ BruceAccount : Account

/ Elspeth : Person

/ Fiona : Person

/ ElspethAccount : Account

/ F ionaAccoun t : Account

/ TheMarket : Market

Page 11: Applying UML 2 to Model-Driven Architecture · S2 Outgoing interface (protocols) Incoming interface (protocols) IBM Software Group | Rational software 15 Connecting Ports! Ports can

IBM Software Group | Rational software

1111

Full Reuse Requires Two-Way Encapsulation

! All objects provide one-way encapsulation! An object doesn’t know who called it

! Full architectural independence requires two-way encapsulation

! An object doesn’t know whom it’s calling! Encapsulation is provided by UML 2.0 ports

! Receive messages in through a port! Send messages out through a port

! Port connection is the responsibility of the architectural context

Page 12: Applying UML 2 to Model-Driven Architecture · S2 Outgoing interface (protocols) Incoming interface (protocols) IBM Software Group | Rational software 15 Connecting Ports! Ports can

IBM Software Group | Rational software

1212

UML 2.0 Ports

Ports

Encapsulation ShellResponse Messages

Stimulus Message

Page 13: Applying UML 2 to Model-Driven Architecture · S2 Outgoing interface (protocols) Incoming interface (protocols) IBM Software Group | Rational software 15 Connecting Ports! Ports can

IBM Software Group | Rational software

1313

! Traditional objects give one-way encapsulation…

Ports: Two-Way Encapsulation

Environment

c : ClsX

S1

S2

Page 14: Applying UML 2 to Model-Driven Architecture · S2 Outgoing interface (protocols) Incoming interface (protocols) IBM Software Group | Rational software 15 Connecting Ports! Ports can

IBM Software Group | Rational software

1414

! Traditional objects give one-way encapsulation…

! Ports fully isolate a structured object’s implementation from its environment in both directions

Ports: Two-Way Encapsulation

Environment

c : ClsX

S1

S2

Outgoing interface (protocols)

Incoming interface (protocols)

Page 15: Applying UML 2 to Model-Driven Architecture · S2 Outgoing interface (protocols) Incoming interface (protocols) IBM Software Group | Rational software 15 Connecting Ports! Ports can

IBM Software Group | Rational software

1515

Connecting Ports

! Ports can be joined by connectors to create peer collaborations composed of structured classes

! Connectors model communication channels! A connector is constrained by port protocols (interfaces)! Static typing rules apply (compatible protocols)

sender:Fax

remote

receiver:Faxremote

Page 16: Applying UML 2 to Model-Driven Architecture · S2 Outgoing interface (protocols) Incoming interface (protocols) IBM Software Group | Rational software 15 Connecting Ports! Ports can

IBM Software Group | Rational software

1616

Agenda

! Introduction! UML 2 Structuring Concepts! Applying the Concepts

!Scalable Modelling!Code Generation!Model-Driven Testing!Thread Assignment

! Conclusion

Page 17: Applying UML 2 to Model-Driven Architecture · S2 Outgoing interface (protocols) Incoming interface (protocols) IBM Software Group | Rational software 15 Connecting Ports! Ports can

IBM Software Group | Rational software

1717

Structured Classes: Internal Structure

! Structured classes may have an internal structure of (structured class) parts and connectors

! Structures compose hierarchically! The architecture is visible

FaxCall

receiveCtrlsendCtrl

sender:Fax

remote

c

receiver:Faxremote

c

Page 18: Applying UML 2 to Model-Driven Architecture · S2 Outgoing interface (protocols) Incoming interface (protocols) IBM Software Group | Rational software 15 Connecting Ports! Ports can

IBM Software Group | Rational software

1818

System2

System1

TerminalA TerminalTester

Library

Terminal

Channel

TerminalTester

Structured Class Reuse: “Software Lego® Blocks”

TerminalA TerminalB

Channel1

Channel2

Page 19: Applying UML 2 to Model-Driven Architecture · S2 Outgoing interface (protocols) Incoming interface (protocols) IBM Software Group | Rational software 15 Connecting Ports! Ports can

IBM Software Group | Rational software

1919

TerminalA TerminalB

Channel1

TerminalA TerminalB

Channel1

Refinement Through Specialization

Channel2

Page 20: Applying UML 2 to Model-Driven Architecture · S2 Outgoing interface (protocols) Incoming interface (protocols) IBM Software Group | Rational software 15 Connecting Ports! Ports can

IBM Software Group | Rational software

2020

Agenda

! Introduction! UML 2 Structuring Concepts! Applying the Concepts

!Scalable Modelling!Code Generation!Model-Driven Testing!Thread Assignment

! Conclusion

Page 21: Applying UML 2 to Model-Driven Architecture · S2 Outgoing interface (protocols) Incoming interface (protocols) IBM Software Group | Rational software 15 Connecting Ports! Ports can

IBM Software Group | Rational software

2121

Full Code Generation

0%

Behaviour

% G

ener

ated

Cod

e

! Generated code includes: 100%

Page 22: Applying UML 2 to Model-Driven Architecture · S2 Outgoing interface (protocols) Incoming interface (protocols) IBM Software Group | Rational software 15 Connecting Ports! Ports can

IBM Software Group | Rational software

2222

Full Code Generation

0%

Behaviour

Structure

% G

ener

ated

Cod

e

! Generated code includes: 100%

Page 23: Applying UML 2 to Model-Driven Architecture · S2 Outgoing interface (protocols) Incoming interface (protocols) IBM Software Group | Rational software 15 Connecting Ports! Ports can

IBM Software Group | Rational software

2323

Full Code Generation

0%

Behaviour

Structure

Hand coding

% G

ener

ated

Cod

e

! Generated code includes: 100%

90%Full benefits of model-driven architecture require structural code generation from the model

•Faster development•Higher quality

Within model

Page 24: Applying UML 2 to Model-Driven Architecture · S2 Outgoing interface (protocols) Incoming interface (protocols) IBM Software Group | Rational software 15 Connecting Ports! Ports can

IBM Software Group | Rational software

2424

Code Generation from Structure Diagrams

Object Construction

Fax = new FaxCall();. .FaxCall::FaxCall() {Sender = new Fax();Receiver = new Fax();. .Fax::Fax() {remote = new Port();c = new Port();}

+ Object Wiring

FaxCall::Sender::Fax::remote –receiver::Fax::remote

FaxCall::Sender::Fax::c – FaxCall::sendCtrlFaxCall:: receiver ::Fax::c – FaxCall:: receiverCtrl

=sender:Fax remote receiver:Faxremote

c c

sendCtrl receiveCtrl

FaxCall

Object Destruction…+

Page 25: Applying UML 2 to Model-Driven Architecture · S2 Outgoing interface (protocols) Incoming interface (protocols) IBM Software Group | Rational software 15 Connecting Ports! Ports can

IBM Software Group | Rational software

2525

Agenda

! Introduction! UML 2 Structuring Concepts! Applying the Concepts

!Scalable Modelling!Code Generation!Model-Driven Testing!Thread Assignment

! Conclusion

Page 26: Applying UML 2 to Model-Driven Architecture · S2 Outgoing interface (protocols) Incoming interface (protocols) IBM Software Group | Rational software 15 Connecting Ports! Ports can

IBM Software Group | Rational software

2626

Sequence Diagrams: Test Specification

! Specification of communication behaviour

! And a specification is a test case…

! Model-driven testing automates the testing process

/ buyer : Person / seller : Person

2: offer2: offer

2.1: accept2.1: accept

2.1.1: pay2.1.1: pay

2.1.1.1: giveGoods2.1.1.1: giveGoods

Create a buyer

Create a seller

Start executionStart execution

Trace this…

…and this…

…and this…

…and this.Did we see what

we specified?

Page 27: Applying UML 2 to Model-Driven Architecture · S2 Outgoing interface (protocols) Incoming interface (protocols) IBM Software Group | Rational software 15 Connecting Ports! Ports can

IBM Software Group | Rational software

2727

Model-Driven Testing

Execute / Results

Model

Design Spec

Build Test Suite

Test Suite SpecTest Results Error Details

Page 28: Applying UML 2 to Model-Driven Architecture · S2 Outgoing interface (protocols) Incoming interface (protocols) IBM Software Group | Rational software 15 Connecting Ports! Ports can

IBM Software Group | Rational software

2828

Test Early, Test Continuously

! Universal truth: early error detection is good! Decreases cost! Improves quality! Decreases schedule risk

! Early testing implies partial testing! Bottom-up: testing of low-level components without the context

that uses them! Top-down: testing of high-level components without the

services they use! How do we test when there are missing parts?

Page 29: Applying UML 2 to Model-Driven Architecture · S2 Outgoing interface (protocols) Incoming interface (protocols) IBM Software Group | Rational software 15 Connecting Ports! Ports can

IBM Software Group | Rational software

2929

Driving A System From The Environment

! One option: drive system “from the edge”

! System under test (SUT) is a completely implemented unit

! External messages drive system! SUT can send messages to external

system

/ buyer : Person / seller : Person

1: buy1: buy

2: offer2: offer

2.1: accept2.1: accept

2.1.1: pay2.1.1: pay

2.1.1.1: giveGoods2.1.1.1: giveGoods

/ b uyer : Person

/ seller : Person

+ / otherPerson

+ / control

+ / otherPerson

+ / control

+ / control

/ b uyer : Person

+ / otherPerson

+ / control

/ seller : Person

+ / otherPerson

+ / control

+ / control

! Good for testing a complete low-level component

! Not good for testing incomplete high-level or peer structures

Page 30: Applying UML 2 to Model-Driven Architecture · S2 Outgoing interface (protocols) Incoming interface (protocols) IBM Software Group | Rational software 15 Connecting Ports! Ports can

IBM Software Group | Rational software

3030

Drivers and Stubs

! Common concepts in testing environments

! Driver: stimulates System Under Test (SUT)

! Stub: used by SUT; enough functionality to simulate missing parts

! Based on a procedural, hierarchical view of a system

SUTSUTSUTSUT

Driver

Stub Stub

Stub

Page 31: Applying UML 2 to Model-Driven Architecture · S2 Outgoing interface (protocols) Incoming interface (protocols) IBM Software Group | Rational software 15 Connecting Ports! Ports can

IBM Software Group | Rational software

3131

Drivers and Stubs

! Common concepts in testing environments

! Driver: stimulates System Under Test (SUT)

! Stub: used by SUT; enough functionality to simulate missing parts

! Based on a procedural, hierarchical view of a system

! Less useful in peer structures! What are drivers and stubs in a

system of communicating objects?

Implemented object

Unimplemented object

Page 32: Applying UML 2 to Model-Driven Architecture · S2 Outgoing interface (protocols) Incoming interface (protocols) IBM Software Group | Rational software 15 Connecting Ports! Ports can

IBM Software Group | Rational software

3232

/ buyer : Person

/ seller : Person

+ / otherPerson

+ / control

+ / otherPerson

+ / control

+ / control

/ buyer : Person

+ / otherPerson

+ / control

/ seller : Person

+ / otherPerson

+ / control

+ / control

Classes Can Be Partially Implemented

! Not all instances of a class should be stubbed simultaneously

Page 33: Applying UML 2 to Model-Driven Architecture · S2 Outgoing interface (protocols) Incoming interface (protocols) IBM Software Group | Rational software 15 Connecting Ports! Ports can

IBM Software Group | Rational software

3333

Classes Can Be Partially Implemented

! Not all instances of a class should be stubbed simultaneously

Ready Buying

Selling

(control)::(buy)/otherPerson.offer().send();

(otherPerson)::(offer)/otherPerson.accept().send();

(otherPerson)::(pay)/otherPerson.giveGoods().send();

(control)::(buy)/otherPerson.offer().send();

(otherPerson)::(offer)/otherPerson.accept().send();

(otherPerson)::(pay)/otherPerson.giveGoods().send();

Page 34: Applying UML 2 to Model-Driven Architecture · S2 Outgoing interface (protocols) Incoming interface (protocols) IBM Software Group | Rational software 15 Connecting Ports! Ports can

IBM Software Group | Rational software

3434

/ buyer : Person

/ seller : Person

+ / otherPerson

+ / control

+ / otherPerson

+ / control

+ / control

/ buyer : Person

+ / otherPerson

+ / control

/ seller : Person

+ / otherPerson

+ / control

+ / control

Classes Can Be Partially Implemented

! Not all instances of a class should be stubbed simultaneously

Ready Buying(control)::(buy)/otherPerson.offer().send();(control)::(buy)/otherPerson.offer().send();

Buyer behaviour

Page 35: Applying UML 2 to Model-Driven Architecture · S2 Outgoing interface (protocols) Incoming interface (protocols) IBM Software Group | Rational software 15 Connecting Ports! Ports can

IBM Software Group | Rational software

3535

Classes Can Be Partially Implemented

! Not all instances of a class should be stubbed simultaneously

Ready

Selling

(otherPerson)::(offer)/otherPerson.accept().send();

(otherPerson)::(pay)/otherPerson.giveGoods().send();

(otherPerson)::(offer)/otherPerson.accept().send();

(otherPerson)::(pay)/otherPerson.giveGoods().send();

Seller behaviour

Different roles may be implemented in different phases

Page 36: Applying UML 2 to Model-Driven Architecture · S2 Outgoing interface (protocols) Incoming interface (protocols) IBM Software Group | Rational software 15 Connecting Ports! Ports can

IBM Software Group | Rational software

3636

Parts Can Be Driver/Stubs

! In a system of peer objects, any object can

! Be a driver: stimulate its peers! Be a stub: receive messages/calls from

its peers and respond according to a specification

! The notions of “driver” and “stub” are merged

! Any object can be manuallystubbed

! Implement minimal behaviour! Why can’t we just generate

stubs from the sequencediagram?

! Because we don’t have the knowledge to automatestructure creation

/ buyer : Person / seller : Person

1: buy1: buy

2: offer2: offer

2.1: accept2.1: accept

2.1.1: pay2.1.1: pay

2.1.1.1: giveGoods2.1.1.1: giveGoods

/ b uyer : Person

/ seller : Person

+ / otherPerson

+ / control

+ / otherPerson

+ / control

+ / control

/ b uyer : Person

+ / otherPerson

+ / control

/ seller : Person

+ / otherPerson

+ / control

+ / control

Page 37: Applying UML 2 to Model-Driven Architecture · S2 Outgoing interface (protocols) Incoming interface (protocols) IBM Software Group | Rational software 15 Connecting Ports! Ports can

IBM Software Group | Rational software

3737

Driver/Stub Automation

! A sequence diagram contains all information necessary to automate stub behaviour implementation

! Received messages! Sent messages! Ordering

! The internal implementation can be trivial

! Handles one (or a set) of test cases only

! Not a good starting point for production design!

/ buyer : Person / seller : Person

1: buy1: buy

2: offer2: offer

2.1: accept2.1: accept

2.1.1: pay2.1.1: pay

2.1.1.1: giveGoods2.1.1.1: giveGoods

Page 38: Applying UML 2 to Model-Driven Architecture · S2 Outgoing interface (protocols) Incoming interface (protocols) IBM Software Group | Rational software 15 Connecting Ports! Ports can

IBM Software Group | Rational software

3838

Stubbing In Hierarchies

! Systems can be very complicated

! Objects at many different levels may be unavailable

! All objects must be stubbable! UML 2 internal structure

diagrams make this possible! Model-driven testing

scales with UML 2 to provide stub generation

/ deviceManager : Dev ic eManager

/ callCon tr ol : CallCon tr oller

/ oamSystem : OAMSubsystem

/ wirelessProxyManager : WirelessPro xyManager

+ / callControl~

+ / dev iceConfig

+ / hardwareAccess

+ / callControl

+ / routing~

+ / channelManagement~

+ / dev iceConfig~+ / routing

+ / hardwareAccess~

+ / channelManagement

/ deviceManager : Dev ic eManager

+ / callControl~

+ / dev iceConfig

+ / hardwareAccess

/ callCon tr ol : CallCon tr oller

+ / callControl

+ / routing~

/ oamSystem : OAMSubsystem

+ / channelManagement~

+ / dev iceConfig~+ / routing

/ wirelessProxyManager : WirelessPro xyManager+ / hardwareAccess~

+ / channelManagement

/ dev ices : Phone

C onstants::cMA XDEV IC ES

/ phoneProxy : C ellPhone Proxy

C onstants::cMA XDEV IC ES

+ / callC ontrol~ + / dev iceC onfig

+ / hardwareA ccess

+ / callC ontrol~

+ / phoneInterface~

+ / dpC onfig

+ / hardwareManagement~+ / phoneInterfa ce

+ / channelManagement

# / extensionC onfig~

+ / callC ontrol~ + / dev iceC onfig

+ / hardwareA ccess

/ dev ices : Phone

+ / callC ontrol~

+ / phoneInterface~

+ / dpC onfig

/ phoneProxy : C ellPhone Proxy

+ / hardwareManagement~+ / phoneInterfa ce

+ / channelManagement

# / extensionC onfig~

C onstants::cMA XDEV IC ES C onstants::cMA XDEV IC ES

/ connectionObserv er : CellPhoneUIConnectionObserver

/ phoneUIFilter : CellPhoneEventFilter

/ uIAccessPoint : UIAccessPoint

+ / hardwareManagement~

+ / phoneInter face

+ / channelManagement

+ / guiStatus

+ / toFilter

+ / phoneInterface+ / phoneUIIF

+ / fromObserver~

+ / channelManagement

+ / fromGUI~

+ / toGUI+ / toGUIStatus

+ / fromGUIStatus~

+ / hardwareManagement~

+ / phoneInter face

+ / channelManagement

/ connectionObserv er : CellPhoneUIConnectionObserver

+ / guiStatus

+ / toFilter

/ phoneUIFilter : CellPhoneEventFilter

+ / phoneInterface+ / phoneUIIF

+ / fromObserver~

+ / channelManagement

/ uIAccessPoint : UIAccessPoint

+ / fromGUI~

+ / toGUI+ / toGUIStatus

+ / fromGUIStatus~

Page 39: Applying UML 2 to Model-Driven Architecture · S2 Outgoing interface (protocols) Incoming interface (protocols) IBM Software Group | Rational software 15 Connecting Ports! Ports can

IBM Software Group | Rational software

3939

Stubbing In Hierarchies

! Systems can be very complicated

! Objects at many different levels may be unavailable

! All objects must be stubbable

! UML 2 internal structure diagrams make this possible

! Model-driven testingscale with UML 2 to provide stub generation

Page 40: Applying UML 2 to Model-Driven Architecture · S2 Outgoing interface (protocols) Incoming interface (protocols) IBM Software Group | Rational software 15 Connecting Ports! Ports can

IBM Software Group | Rational software

4040

Agenda

! Introduction! UML 2 Structuring Concepts! Applying the Concepts

!Scalable Modelling!Code Generation!Model-Driven Testing!Thread Assignment

! Conclusion

Page 41: Applying UML 2 to Model-Driven Architecture · S2 Outgoing interface (protocols) Incoming interface (protocols) IBM Software Group | Rational software 15 Connecting Ports! Ports can

IBM Software Group | Rational software

4141

Active Object Conceptual Threads

! Some systems have complex concurrency needs! Solution: Active object pattern—object with conceptual thread

! Light weight, suitable for core application logic! Run-to-completion semantics

FaxCall

receiveCtrlsendCtrl

sender:Fax

remote

receiver:Faxremote

c c

Conceptual thread

Conceptual thread

Conceptual thread

Page 42: Applying UML 2 to Model-Driven Architecture · S2 Outgoing interface (protocols) Incoming interface (protocols) IBM Software Group | Rational software 15 Connecting Ports! Ports can

IBM Software Group | Rational software

4242

The Thread Assignment Problem

! Active object conceptual threads must be mapped to operating system threads…how?

! All on one OS thread?! Can’t handle blocking behaviour

! Every object on its own OS thread?! Way too expensive! Slow, lots of memory

! All objects on a single thread, except for those on their own OS threads?

! Better, but doesn’t handle cooperating objects! Natural concurrency patterns are structurally nested

! Most objects run or block with their parents! This perfectly fits structural modelling

Page 43: Applying UML 2 to Model-Driven Architecture · S2 Outgoing interface (protocols) Incoming interface (protocols) IBM Software Group | Rational software 15 Connecting Ports! Ports can

IBM Software Group | Rational software

4343

Thread Assignment Example

! Sender is on its own thread! Fax and receiver are on same thread

! Concurrency protection provided by active objects

sender:Faxremote

c

remotereceiver:Fax

c

sendCtrl receiveCtrl

fax:FaxCall

Main thread

Override onto own thread

Defaults to main thread

Page 44: Applying UML 2 to Model-Driven Architecture · S2 Outgoing interface (protocols) Incoming interface (protocols) IBM Software Group | Rational software 15 Connecting Ports! Ports can

IBM Software Group | Rational software

4444

Agenda

! Introduction! UML 2 Structuring Concepts! Applying the Concepts

!Scalable Modelling!Code Generation!Model-Driven Testing!Thread Assignment

! Conclusion

Page 45: Applying UML 2 to Model-Driven Architecture · S2 Outgoing interface (protocols) Incoming interface (protocols) IBM Software Group | Rational software 15 Connecting Ports! Ports can

IBM Software Group | Rational software

4545

Conclusion

! UML 2.0 will include structuring concepts! Classes with structure, parts, ports, connectors

! This enables many types of automation! Scalable Modelling! Code Generation! Model-Driven Testing! Thread Assignment! And more…

! Generating structural code gives benefits in unexpected areas

! Fully applying UML 2 enables a new level of model-driven architecture

Page 46: Applying UML 2 to Model-Driven Architecture · S2 Outgoing interface (protocols) Incoming interface (protocols) IBM Software Group | Rational software 15 Connecting Ports! Ports can

IBM Software Group | Rational software

4646