Executable Translatable UML
Stephen J. MellorChief Scientist
System ComplexityPrice Performance
The Evolution of Software Development
Assembly
CompilerAssembler
MachineCode
High LevelLanguage
UML Models
Model Compiler
1990s1980s 2000s
AssemblyHigh LevelLanguage
IncreasedProductivity
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
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
Systems Development Flow
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 {
...
}
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
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 { …
.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 {
...
}
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
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
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
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
Model Execution
Execute models with an interpreter to verify behavior.
Vs.
ApplicationModel
ModelExecution
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
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
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
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
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
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
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
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
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.)
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
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
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
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
Nucleus BridgePoint ProductModel Construction
Model Execution
ModelCompilation
ModelDebugging
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.
.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 {
...
}
Thank you
Questions?