310 likes | 432 Views
Executable Translatable UML. Stephen J. Mellor Chief Scientist. The Evolution of Software Development. Price Performance. System Complexity. High Level Language. Assembly. UML Models. Model Compiler. Assembler. Compiler. Machine Code. High Level Language. Assembly. 2000s.
E N D
Executable Translatable UML Stephen J. MellorChief Scientist
The Evolution of Software Development Price Performance System Complexity High Level Language Assembly UML Models Model Compiler Assembler Compiler Machine Code High Level Language Assembly 2000s 1980s 1990s Increased Productivity
UML – The Next Language • UML is the industry-standard • Executable UML is: • Streamlined • Tractable • Subset of UML • Achieved by having defined execution rules • Moving to higher levels of abstraction can improve: • Time to market • Productivity • Understandability • Maintainability • Quality • Reuse • etc...
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
Checking Checking Settings Entry/ OpenShutter( 0.5 ); MeasureLight(); Checking Analysis Design Code // Shutter Class Class Shutter_c { ... } // Exposure Class Class Exposure_c { ... } Che cking Che Ckin Che cking g Che cking Che Ckin Che cking g Checking Checking Checking Settings Entry/ OpenShutter( 0.5 ); MeasureLight(); DetermineExposureTime( Checking Checking Checking Settings Entry/ OpenShutter( 0.5 ); MeasureLight(); DetermineExposureTime( Checking Checking Design Translation as a Process 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.
Che cking Che Ckin Che cking g Checking Checking Checking Settings Entry/ OpenShutter( 0.5 ); MeasureLight(); DetermineExposureTime( Checking Checking Checking Settings Entry/ OpenShutter( 0.5 ); MeasureLight(); Checking Separation Application 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
Code Che cking Che Ckin Che cking g // Shutter Class Class Shutter_c { ... } // Exposure Class Class Exposure_c { ... } Checking Checking Settings Entry/ OpenShutter( 0.5 ); MeasureLight(); DetermineExposureTime( Checking Checking Automated Translation Design Translation as a Product Application Now design translation is a product. • constructed once, and • executed automatically over and over. This approach…. • leverages expertise of best architects, • captures that expertise. .select many classes from instances of Class; .for each class in classes Class ${class.name}_c { … Architecture
Checking Checking Settings Entry/ OpenShutter( 0.5 ); MeasureLight(); Checking Che cking Che Ckin Che cking g Analysis Design Code // Shutter Class Class Shutter_c { ... } // Exposure Class Class Exposure_c { ... } We Have a Choice Checking Settings Entry/ OpenShutter( 0.5 ); MeasureLight(); DetermineExposureTime( Che cking Che Ckin Che cking g Che cking Che Ckin Che cking g .select many classes from instances of Class; .for each class in classes Class ${class.name}_c { … Checking Checking Checking Settings Entry/ OpenShutter( 0.5 ); MeasureLight(); DetermineExposureTime( Checking Checking Checking Settings Entry/ OpenShutter( 0.5 ); MeasureLight(); DetermineExposureTime( Checking Checking Checking Application Code Model Compiler Checking // Shutter Class Class Shutter_c { ... } // Exposure Class Class Exposure_c { ... } Checking Architecture
Comprehensive software design flow Application Development LegacyCode Model Execution Model Debugging Instrumented native code Application Model Compiled Embedded Code (C, C++,Java ….) Models Application Software Model Compilation Application Definition Source Level Debugging Middle ware Architecture Definition RTOS Rules ArchitectureRules HW IP CPU System Prototyping Native code LegacyCode Rule Execution Architecture Development Design Compilation Debugging Deployment Verification Translation
Application development • Build a model for each domain • Legacy and COTS code can also be integrated • Execute the models LegacyCode Model Execution Application Model Application Model Models LegacyCode Rules ArchitectureRules Rule Execution Legacy Code Model Execution
Application Models Application Model • Class Diagram • Statechart Diagram • Action Language Exposure Exposure # {I} Shutter ID {R4} NumberOfBytes FileFolder {R5} Status Shutter Shutter ID {I} Aperture Zoom OpenTime Status R4 Action for Checking Settings Closed Checking Settings Entry/ OpenShutter( 0.5 ); MeasureLight( ); DetermineExposureTime( Mode ); Half ( ShutterID ) Defines Lifecycle for Shutter Released ( ShutterID ) Checking Settings Full( ShutterID ) Open Released( Shutter ID )
State Name {I} Class {R7} isFinal Closed Shutter Shutter ID {I} Aperture Zoom OpenTime Status Checking Open Application Intelligent Model Capture Application Model Class Number {I} Name KeyLetters Description Metamodel Repository Intelligent model capture verifies models: • syntactically • semantically
Model Execution Execute models with an interpreter to verify behavior. Vs. Model Execution Application Model
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 Application Development LegacyCode Model Execution Model Debugging Instrumented native code Application Model Compiled Embedded Code (C, C++,Java ….) Models Application Software Model Compilation Application Definition Source Level Debugging Middle ware Architecture Definition RTOS Rules ArchitectureRules HW IP CPU System Prototyping Native code LegacyCode Rule Execution Architecture Development Design Compilation Debugging Deployment Verification Translation
LegacyCode Model Execution Application Model Models Architecture Development • Select a set of rules that meet the requirements of the architecture • Legacy and COTS code can be integrated • Execute the rules Rules ArchitectureRules LegacyCode Rule Execution
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 Target embedded systems using C ArchitectureRules Target embedded systems using C++ ArchitectureRules Target embedded systems using C with special properties
State Name {I} Class {R7} isFinal Closed .select many classes from instances of Class; .for each class in classes Class ${class.name}_c { … Checking Open .select many states related by class->State[R7] where isFinal ==FALSE; .for each state in states void ${state.name}Action( ) { … Architecture rules Class Number {I} Name KeyLetters Description Metamodel Repository Shutter Shutter ID {I} Aperture Zoom OpenTime Status Application Rules
Shutter Exposure R4 Closed Checking Open Architecture rules .select many classes from instances of Class; .for each class in classes Class ${class.name}_c { … Class Shutter_c { … Class Exposure_c { … Variable name From application .select many states related by class->State[R7] where isFinal == FALSE; .for each state in states void ${state.name}Action( ) { … void OpenAction() { … void CheckingAction() { … void ClosedAction() { … Clear text
.select many invocations related by activity->Invocation[R17] where markDigitalOutput == True; .select many parameters related by invocation -> Parameter[R18] .for each invocation in invocations DigitalOutputFunction( .for each parameter in parameters .if (not Last) ${ parameter.Name } , .else ${ parameter.Name } ) ; .end for .end for Legacy Code and COTS • Legacy code, libraries, COTS, hand-written code etc can all be incorporated by building a wrapper in the architecture rules Mark Name of function in library
LegacyCode Model Execution Application Model Models 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 Rules ArchitectureRules LegacyCode Rule Execution
Instrumented native code Compiled Embedded Code (C, C++,Java ….) Compiled Embedded Code (C, C++,Java ….) Models Model Compilation Rules Native code Model compilation Application Models • Model compilation is the execution of the architecture rules over the application to produce text • (That is, code in any language the rules specify.) Architecture Rules
Performance • If any dimension of system performance is inadequate, modify the rules • Each modification will improve to fit • Do not change the application models! LegacyCode Model Execution Application Model Models Rules ArchitectureRules LegacyCode Rule Execution
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 Model Debugging Instrumented native code Compiled Embedded Code (C, C++,Java ….) Compiled Embedded Code (C, C++,Java ….) Model Compilation Source Level Debugging System Prototyping Native code
Model debugging Model-level debugging 1. Set model-level breakpoint 2. Halt execution and view model-level trace 3. Hyper-link to related instances for inspection
Comprehensive software design flow Application Development LegacyCode Model Execution Model Debugging Instrumented native code Application Model Compiled Embedded Code (C, C++,Java ….) Models Application Software Model Compilation Application Definition Source Level Debugging Middle ware Architecture Definition RTOS Rules ArchitectureRules HW IP CPU System Prototyping Native code LegacyCode Rule Execution Architecture Development Design Compilation Debugging Deployment Verification Translation
Nucleus BridgePoint Product ModelCompilation Model Construction ModelDebugging Model Execution
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 openModel Compilers.
Checking Checking Settings Entry/ OpenShutter( 0.5 ); MeasureLight(); Checking Che cking Che Ckin Che cking g Analysis Design Code // Shutter Class Class Shutter_c { ... } // Exposure Class Class Exposure_c { ... } We Have a Choice Checking Settings Entry/ OpenShutter( 0.5 ); MeasureLight(); DetermineExposureTime( Che cking Che Ckin Che cking g Che cking Che Ckin Che cking g .select many classes from instances of Class; .for each class in classes Class ${class.name}_c { … Checking Checking Checking Settings Entry/ OpenShutter( 0.5 ); MeasureLight(); DetermineExposureTime( Checking Checking Checking Settings Entry/ OpenShutter( 0.5 ); MeasureLight(); DetermineExposureTime( Checking Checking Checking Application Code Model Compiler Checking // Shutter Class Class Shutter_c { ... } // Exposure Class Class Exposure_c { ... } Checking Architecture
Thank you Questions?