Executable Translatable UML Stephen J. Mellor Chief Scientist.

31
Executable Translatable UML Stephen J. Mellor Chief Scientist

Transcript of Executable Translatable UML Stephen J. Mellor Chief Scientist.

Page 1: Executable Translatable UML Stephen J. Mellor Chief Scientist.

Executable Translatable UML

Stephen J. MellorChief Scientist

Page 2: Executable Translatable UML Stephen J. Mellor Chief Scientist.

System ComplexityPrice Performance

The Evolution of Software Development

Assembly

CompilerAssembler

MachineCode

High LevelLanguage

UML Models

Model Compiler

1990s1980s 2000s

AssemblyHigh LevelLanguage

IncreasedProductivity

Page 3: Executable Translatable UML Stephen J. Mellor Chief Scientist.

UML – The Next Language

Moving to higher levels of abstraction can improve:

— Time to market— Productivity— Understandability— Maintainability — Quality— Reuse— etc...

UML is the industry-standard Executable UML is:

— Streamlined— Tractable— Subset of UML

Achieved by having defined execution rules

Page 4: Executable Translatable UML Stephen J. Mellor Chief Scientist.

xtUML

(X) Execute models— Allows for early verification— Pre-code interpretive execution— Integration of legacy code

(T) Translate models— Complete code generation from

models— Customizable compilation rules— Optimized code

Testing the model early bridges the verification gap

Page 5: Executable Translatable UML Stephen J. Mellor Chief Scientist.

Systems Development Flow

Page 6: Executable Translatable UML Stephen J. Mellor Chief Scientist.

Until now, design translation has been: carried out on a case-by-case basis, over and over and over and over.

This approach fails to: leverage expertise of best designers, capture that expertise.

Design Translation as a Process

Checking SettingsEntry/OpenShutter( 0.5 );MeasureLight();DetermineExposureTime(

Checking

Checking

Checking

Checking

CheCkinChecking g

Analysis

Checking SettingsEntry/OpenShutter( 0.5 );MeasureLight();DetermineExposureTime(

Checking

Checking

Checking

Checking

CheCkinChecking g

Design

Checking

Checking Checking SettingsEntry/

OpenShutter( 0.5 );MeasureLight();

Code // Shutter Class

Class Shutter_c {

...

}

// Exposure Class

Class Exposure_c {

...

}

Page 7: Executable Translatable UML Stephen J. Mellor Chief Scientist.

Separation

Design can be split between:

Subject matter experts who understand the application, and

Embedded experts who understand the architecture

Each evolves at its own pace.Architecture

Checking

Checking

Checking SettingsEntry/

OpenShutter( 0.5 );MeasureLight();

Checking SettingsEntry/OpenShutter( 0.5 );MeasureLight();DetermineExposureTime(

Checking

Checking

Checking

Checking

CheCkinChecking g

Application

Page 8: Executable Translatable UML Stephen J. Mellor Chief Scientist.

Design Translation as a Product

Architecture

Checking SettingsEntry/OpenShutter( 0.5 );MeasureLight();DetermineExposureTime(

Checking

Checking

Checking

Checking

CheCkinChecking g

ApplicationNow design translation is a product. constructed once, and executed automatically over and over.

This approach…. leverages expertise of best architects, captures that expertise.

Code

// Shutter Class

Class Shutter_c {

...

}

// Exposure Class

Class Exposure_c {

...

}

Automated Translation

.select many classes from instances of Class;.for each class in classesClass ${class.name}_c { …

Page 9: Executable Translatable UML Stephen J. Mellor Chief Scientist.

.select many classes from instances of Class;.for each class in classesClass ${class.name}_c { …

We Have a Choice

Code // Shutter Class

Class Shutter_c {

...

}

// Exposure Class

Class Exposure_c {

...

}

ModelCompiler

Checking

Checking

Checking Checking SettingsEntry/OpenShutter( 0.5 );MeasureLight();DetermineExposureTime(

Checking

CheCkinChecking g

Application

Architecture

Checking SettingsEntry/OpenShutter( 0.5 );MeasureLight();DetermineExposureTime(

Checking

Checking

Checking

Checking

CheCkinChecking g

Analysis

Checking SettingsEntry/OpenShutter( 0.5 );MeasureLight();DetermineExposureTime(

Checking

Checking

Checking

Checking

CheCkinChecking g

Design

Checking

Checking Checking SettingsEntry/

OpenShutter( 0.5 );MeasureLight();

Code // Shutter Class

Class Shutter_c {

...

}

// Exposure Class

Class Exposure_c {

...

}

Page 10: Executable Translatable UML Stephen J. Mellor Chief Scientist.

Comprehensive software design flow

ModelDebugging

ModelDebugging

LegacyCode

LegacyCode

Verification Translation Compilation

ApplicationDefinition

ApplicationDefinition

ArchitectureDefinition

ArchitectureDefinition

SourceLevel

Debugging

SourceLevel

Debugging

Debugging Deployment

SystemPrototyping

SystemPrototyping

Architecture Development

Application Development

ArchitectureRules

ArchitectureRules

ApplicationModel

ApplicationModel

RuleExecution

ModelExecution

Compiled Embedded Code

(C, C++,Java ….)

ModelCompilation

ModelCompilation

Native code

Application

Software

Middle

wareRTOS

HW

IPCPU

Models

Rules

Instrumented native code

Design

LegacyCode

LegacyCode

Page 11: Executable Translatable UML Stephen J. Mellor Chief Scientist.

Application development

Build a model for each domain

Legacy and COTS code can also be integrated

Execute the models

LegacyCode

LegacyCode

ApplicationModel

ApplicationModel

ModelExecution

Models

ArchitectureRules

RuleExecution

Rules

ApplicationModel

ApplicationModel

LegacyCode

LegacyCode

ModelExecution

Legacy Code

Page 12: Executable Translatable UML Stephen J. Mellor Chief Scientist.

Application Models

Class Diagram Statechart Diagram Action Language

Checking Settings

Entry/OpenShutter( 0.5 );MeasureLight( );DetermineExposureTime( Mode );

Defines Lifecycle for Shutter

Action for Checking Settings

Shutter

Shutter ID {I}ApertureZoomOpenTimeStatus

Exposure

Exposure # {I}Shutter ID {R4}NumberOfBytesFileFolder {R5}Status

R4

Closed

Checking Settings

Open

Half ( ShutterID )

Released( Shutter ID )

Released ( ShutterID )

Full( ShutterID )

ApplicationModel

ApplicationModel

Page 13: Executable Translatable UML Stephen J. Mellor Chief Scientist.

Intelligent Model Capture

StateName {I}Class {R7}isFinal

ClassNumber {I}NameKeyLettersDescription

Application

ShutterShutter ID {I}ApertureZoomOpenTimeStatus Closed

Checking

Open

Class

Number Name

101 Shutter

102 Exposure

State

Name Class Number isFinal

Closed 101 973 No

Checking 101 974 No

Open 101 975 No

Metamodel

Repository

Intelligent model capture verifies models:

— syntactically

— semantically

ApplicationModel

ApplicationModel

Page 14: Executable Translatable UML Stephen J. Mellor Chief Scientist.

Model Execution

Execute models with an interpreter to verify behavior.

Vs.

ApplicationModel

ModelExecution

Page 15: Executable Translatable UML Stephen J. Mellor Chief Scientist.

Actions

Standard part of UML

Provide for complete code generation 7-10 lines of generated code per line of

action language Allows “difficult”code to be generated

reliably

Independence from Software platform Ability to reorganize data and control

structures

Page 16: Executable Translatable UML Stephen J. Mellor Chief Scientist.

Comprehensive software design flow

ModelDebugging

ModelDebugging

LegacyCode

LegacyCode

Verification Translation Compilation

ApplicationDefinition

ApplicationDefinition

ArchitectureDefinition

ArchitectureDefinition

SourceLevel

Debugging

SourceLevel

Debugging

Debugging Deployment

SystemPrototyping

SystemPrototyping

Architecture Development

Application Development

ArchitectureRules

ArchitectureRules

ApplicationModel

ApplicationModel

RuleExecution

ModelExecution

Compiled Embedded Code

(C, C++,Java ….)

ModelCompilation

ModelCompilation

Native code

Application

Software

Middle

wareRTOS

HW

IPCPU

Models

Rules

Instrumented native code

Design

LegacyCode

LegacyCode

Page 17: Executable Translatable UML Stephen J. Mellor Chief Scientist.

Architecture Development

Select a set of rules that meet the requirements of the architecture

Legacy and COTS code can be integrated

Execute the rules

ArchitectureRules

ArchitectureRules

RuleExecution

Rules

LegacyCode

LegacyCode

ApplicationModel

ModelExecution

Models

LegacyCode

LegacyCode

Page 18: Executable Translatable UML Stephen J. Mellor Chief Scientist.

Select Architecture Rules

Different architecture rules target different software platforms

You may buy Architecture Rules

You may reuse Architecture Rules

You may modify Architecture Rules

ArchitectureRules

ArchitectureRules

ArchitectureRules

ArchitectureRules

Target embedded systems using C

Target embedded systems using C++

ArchitectureRules

ArchitectureRules

Target embedded systems using C with special properties

Page 19: Executable Translatable UML Stephen J. Mellor Chief Scientist.

Architecture rules

Application

StateName {I}Class {R7}isFinal

.select many classes from instances of Class;

.for each class in classesClass ${class.name}_c { …

.select many states related by class->State[R7] where isFinal ==FALSE;.for each state in statesvoid ${state.name}Action( ) { …

ClassNumber {I}NameKeyLettersDescription

ShutterShutter ID {I}ApertureZoomOpenTimeStatus Closed

Checking

Open

Class

Number Name

101 Shutter

102 Exposure

State

Name Class Number isFinal

Closed 101 973 No

Checking 101 974 No

Open 101 975 No

Metamodel

Repository

Rules

Page 20: Executable Translatable UML Stephen J. Mellor Chief Scientist.

Architecture rules

.select many classes from instances of Class;.for each class in classesClass ${class.name}_c { …

.select many states related by class->State[R7] where isFinal == FALSE;.for each state in statesvoid ${state.name}Action( ) { …

Class Shutter_c { …

Class Exposure_c { …

void OpenAction() { …

void CheckingAction() { …

void ClosedAction() { …

From application

Clear text Closed

Checking

Open

Variable name

R4

Shutter Exposure

Page 21: Executable Translatable UML Stephen J. Mellor Chief Scientist.

Legacy Code and COTS

Legacy code, libraries, COTS, hand-written code etc can all be incorporated by building a wrapper in the architecture rules

.select many invocations related by activity->Invocation[R17] where markDigitalOutput == True;.select many parameters related by invocation -> Parameter[R18] .for each invocation in invocationsDigitalOutputFunction(

.for each parameter in parameters.if (not Last) ${ parameter.Name } ,.else ${ parameter.Name } ) ;

.end for.end for

Name of function in library

Mark

Page 22: Executable Translatable UML Stephen J. Mellor Chief Scientist.

Rule Execution If you change a rule,

it needs to be verified by execution

On execution, the rules should continue to yield correct code

Verify using a Test Executable UML program

LegacyCode

LegacyCode

ApplicationModel

ModelExecution

Models

ArchitectureRules

ArchitectureRules

RuleExecution

Rules

LegacyCode

LegacyCode

Page 23: Executable Translatable UML Stephen J. Mellor Chief Scientist.

ArchitectureRules

Model compilationApplication

Models

Compiled Embedded Code

(C, C++,Java ….)

ModelCompilation

ModelCompilation

Native code

Models

Rules

Instrumented native code

Compiled Embedded Code

(C, C++,Java ….)

Model compilation is the execution of the architecture rules over the application to produce text

(That is, code in any language the rules specify.)

Page 24: Executable Translatable UML Stephen J. Mellor Chief Scientist.

Performance

If any dimension of system performance is inadequate, modify the rules

Each modification will improve to fit

Do not change the application models!

ArchitectureRules

ArchitectureRules

RuleExecution

Rules

LegacyCode

LegacyCode

ApplicationModel

ApplicationModel

ModelExecution

Models

LegacyCode

LegacyCode

Page 25: Executable Translatable UML Stephen J. Mellor Chief Scientist.

Model Debugging Allows you to verify

the compiled model Set model-level

breakpoints Halt execution View model-level

trace Hyper-link to related

instances for inspection

Compiled Embedded Code

(C, C++,Java ….)

ModelDebugging

ModelDebugging

SourceLevel

Debugging

SourceLevel

Debugging

SystemPrototyping

SystemPrototyping

Compiled Embedded Code

(C, C++,Java ….)

ModelCompilation

ModelCompilation

Native code

Instrumented native code

Page 26: Executable Translatable UML Stephen J. Mellor Chief Scientist.

Model debugging

1. Set model-level breakpoint

2. 2. Halt execution and view model-level trace

3. Hyper-link to related instances for inspection

Model-level debugging

Page 27: Executable Translatable UML Stephen J. Mellor Chief Scientist.

Comprehensive software design flow

ModelDebugging

ModelDebugging

LegacyCode

LegacyCode

Verification Translation Compilation

ApplicationDefinition

ApplicationDefinition

ArchitectureDefinition

ArchitectureDefinition

SourceLevel

Debugging

SourceLevel

Debugging

Debugging Deployment

SystemPrototyping

SystemPrototyping

Architecture Development

Application Development

ArchitectureRules

ArchitectureRules

ApplicationModel

ApplicationModel

RuleExecution

ModelExecution

Compiled Embedded Code

(C, C++,Java ….)

ModelCompilation

ModelCompilation

Native code

Application

Software

Middle

wareRTOS

HW

IPCPU

Models

Rules

Instrumented native code

Design

LegacyCode

LegacyCode

Page 28: Executable Translatable UML Stephen J. Mellor Chief Scientist.

Nucleus BridgePoint ProductModel Construction

Model Execution

ModelCompilation

ModelDebugging

Page 29: Executable Translatable UML Stephen J. Mellor Chief Scientist.

4 requirements for effective code generation

Every system is different, so we need complete control over the generated code.

Not all code is equal, so we need specific and precise control over the generated code.

No code is an island, so we needintegration of legacy and generated code.

Partial generation requires synchronization, so we needcompleteness of code generation.

These requirements are met by open Model Compilers.

Page 30: Executable Translatable UML Stephen J. Mellor Chief Scientist.

.select many classes from instances of Class;.for each class in classesClass ${class.name}_c { …

We Have a Choice

Code // Shutter Class

Class Shutter_c {

...

}

// Exposure Class

Class Exposure_c {

...

}

ModelCompiler

Checking

Checking

Checking Checking SettingsEntry/OpenShutter( 0.5 );MeasureLight();DetermineExposureTime(

Checking

CheCkinChecking g

Application

Architecture

Checking SettingsEntry/OpenShutter( 0.5 );MeasureLight();DetermineExposureTime(

Checking

Checking

Checking

Checking

CheCkinChecking g

Analysis

Checking SettingsEntry/OpenShutter( 0.5 );MeasureLight();DetermineExposureTime(

Checking

Checking

Checking

Checking

CheCkinChecking g

Design

Checking

Checking Checking SettingsEntry/

OpenShutter( 0.5 );MeasureLight();

Code // Shutter Class

Class Shutter_c {

...

}

// Exposure Class

Class Exposure_c {

...

}

Page 31: Executable Translatable UML Stephen J. Mellor Chief Scientist.

Thank you

Questions?