SlideShare a Scribd company logo
Welcome A Practical Guide to Code Generation using Model Driven Architecture and Executable UML  25 Jun 2008 Chris Raistrick, Kennedy Carter [email_address] KC.COM
Agenda ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Evolution or (Industrial) Revolution?
The Industrial Revolution Before 1800 ,[object Object],[object Object],[object Object],[object Object],After 1800 ,[object Object],[object Object],[object Object],[object Object]
Elaboration Based Process The deliverables are up to 300% redundant… … and maintenance costs are correspondingly high Requirements (Text / Use Cases) This must be changed… or become obsolete This must be changed… or become obsolete This must be changed When this changes manually build a  Platform Specific Model … PSM (UML) manually code a  Platform Specific Implementation PSI (Ada/C++) manually build a  Platform Independent Model … PIM (UML) Process definition Design policies Imp’n rules
Elaboration vs. Translation PSM (UML) Process definition Design policies Coding rules manually code a  Platform Specific Implementation PSI (Ada/C++) manually build a  Platform Independent Model … PIM (UML) Elaborate Translate manually build a  Platform Specific Model … PSI (Ada/C/C++) automatically generate a  Platform Specific Implementation  using PIM-PSI mappings PIM-PSI Mappings (xUML) manually specify  mappings onto the platform … manually build a  Platform Independent Model … PIM (xUML) Requirement Change impact Technology Change impact
Translation Based Process Translate The knowledge in the heads of developers is: - Formalized - Accessible - Reusable - Refinable Process definition Design policies Coding rules PSI (Ada/C/C++) automatically generate a  Platform Specific Implementation  using PIM-PSI mappings PIM-PSI Mappings (xUML) manually specify  mappings onto the platform … manually build a  Platform Independent Model … PIM (xUML)
Formalized Application and Software Design Expertise PIM-PSI Mappings (xUML) automatically generate a  Platform Specific Implementation  using PIM-PSI mappings manually specify  mappings onto the platform … manually build a  Platform Independent Model … PIM (xUML) Rules and policies for organising aircraft Process definition Design policies Coding rules PSI (Code) Rules and policies for organising software
Platform Independent Modelling
Platform Independent Modelling ,[object Object],[object Object],[object Object],[object Object],xUML Model (PIM) Platform-Specific Configuration System Model Populate xUML-Code Mappings iCCG Code Generator Code Generator Generate Generated Code xUML Runtime Layer Generated System Adaptation Layer
The xUML Model Structure System Model Domains Classes Operations States xUML Model (PIM) Platform-Specific Configuration
Isn’t xUML with ASL Just Coding in Another Language? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Metamodel Based Code Generation
The Code Generator: Domains Populate Generate System Model Code Generator Generated Code xUML Runtime Layer Generated System Adaptation Layer The code generator itself is a set of domain models expressed using xUML. The domains represent the various components of an xUML system. (Part of) Code Generator Domain Chart xUML Model (PIM) Platform-Specific Configuration xUML-Code Mappings iCCG Code Generator
The Code Generator: Classes and Methods (Part of)  Configurable Code Generator Domain Chart iCCG Code Generator Code Generator xUML-Code Mappings (Part of) Executable UML Class Model the classes in each domain represent the elements that make up those components.  Method to Generate Java Method to Generate Ada Method to Generate C++ Method to Generate C … $FORMAT header_file typedef struct C[I:this.class_ID]_struct { /* "[T:this.class_name]" Class Header */ struct s_object *next_instance; $ENDFORMAT … Each element contains operations which specify how to map that xUML element onto a specific target language.
Build a PIM ,[object Object],Platform Independent Model : Class Diagram Populate Generate xUML Model (PIM) Platform-Specific Configuration System Model xUML-Code Mappings iCCG Code Generator Code Generator Generated Code xUML Runtime Layer Generated System Adaptation Layer
Instantiate the Formalism Metamodel Domain Instance Class Instances Attribute Instances Populated Executable UML Class Model When the Executable UML domain is populated with the PIM components, we see these instances… Populate xUML Model (PIM) Platform-Specific Configuration System Model xUML-Code Mappings iCCG Code Generator Code Generator
The Metamodels Embody the Code Generation Rules Domain.generateCode Class.generateCode Attribute.generateCode The task of translation involves iterating through these instances and generating suitable code from them.  iCCG Code Generator Code Generator xUML-Code Mappings
Generate the Code Platform Independent Model : Class Diagram Generated C Code Generate Generate xUML-Code Mappings iCCG Code Generator Code Generator Generated Code xUML Runtime Layer Generated System Adaptation Layer
We have illustrated generation of data structures from the class model.  The process of generating code from the action language is the same, and based upon populating and translating instances in the “Action Language” domain… Generating Code from Action Language Note that the “generateCode” operation of the “ASL Statement” class is polymorphic, allowing us to implement rival versions of this method for each type of ASL statement, represented as the subclasses “Create Statement”, “Delete Statement” and so on   polymorphic operation with different polymorphic methods to generate code for each different ASL statement
Generate the Code Generator Project Code Generator Pre-Existing Code Generator Project Domain Models Project Code Code Generator PIM (part of) xUML Metamodel Domain Class Attribute xUML Metamodels xUML to Code Mappings in ASL
Code Generation Overview Populate Generate xUML Model (PIM) Platform-Specific Configuration System Model xUML-Code Mappings iCCG Code Generator Code Generator Generated Code xUML Runtime Layer Generated System Adaptation Layer PLATFORM SPECIFIC CONFIGURATION FILE PROCESS "Process One" ONE 1 127.0.0.1 1000 1600 PROCESS "Process Two" TWO 1 127.0.0.1 1001 1601 CLASS-PROCESS WM TGT ONE CLASS-PROCESS WM WPN TWO (part of) xUML Metamodel Domain Class Attribute owning_domain = this -> R2 $FORMAT header_file typedef struct D[I:owning_domain.domain_ID]_C[I:this.class_ID]_struct { /* "[T:this.class_name]" Class Header */ struct s_object *next_instance; /* Linked list of  */ struct s_object *prev_instance; /* object instances  */ struct s_object *rel_ptr;  /* list of rel'ns  */ struct s_object *cpr_ptr;  /* list of cp rel'ns  */ $ENDFORMAT {attributes_in_class} = this -> R3 for the_attribute in {attributes_in_class} do [] = ATT1:generateCode [header_file] on the_attribute endfor $FORMAT header_file }; $ENDFORMAT Multi-node multi-process runtime Windows Vista adaptation layer
Optimisation
Structured or Object-Oriented? ,[object Object],Encapsulated data structure containing dynamically allocated injection demand records Application code modules Global data structure containing a static array of injection demand records add injection demand get injection time remove injection demand injection demand add injection demand get injection time remove injection demand injection demand create get time delete get volume
How do they compare? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Application code modules Encapsulated data structure containing dynamically allocated injection demand records Global data structure containing a static array of injection demand records add injection demand get injection time remove injection demand injection demand add injection demand get injection time remove injection demand injection demand create get time delete get volume
With automatic code generation? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Application code modules Encapsulated data structure containing dynamically allocated injection demand records Global data structure containing a static array of injection demand records add injection demand get injection time remove injection demand injection demand add injection demand get injection time remove injection demand injection demand create get time delete get volume
Avoiding Memory Management ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Customer custId custName custAddress custId  array custName  array custAddress  array
Optimized Instance Handles The first element is a status indicator: 0 means “undefined”, 1 means “defined”. The second element (which is defined only if the first element is 1) is an index into the attribute arrays of the object it references, i.e. an object “pointer”. An   instance handle   can be realised as a 2-element array of integers. Instance attributes   can be realised as fixed-length arrays, with a flag for each index to indicate whether that instance exists Customer custId custName custAddress
Optimized Associations note that creating and deleting objects and links does not involve any dynamic memory management… … even though there are ‘create’ and ‘delete’ statements in the PIM A binary association is implemented as two 2-dimensional arrays. Each array implements the association in one direction only. Customer End Account End Customer 0 owns Account 2 Account 6 is owned by Customer 2 accountId dateOpened balance ownerId status Account owns is owned by 1..* 0..1 R1 Customer custId custName custAddress
Generating Complex Architectures
Formalism vs. Architecture Centric Metamodels UML Metamodel PIM Instantiate Define Mapping Apply Mapping PSI Metamodel PSI ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Formalism Centric UML Metamodel PIM Instantiate PSM Metamodel Define Mapping PSM Apply Mapping PSI Metamodel Define Mapping PSI Apply Mapping More sophisticated architectures require a more sophisticated approach… …based upon building  architecture centric  metamodels Architecture Centric
Formalism Centric Metamodels ,[object Object],{allDomains} =  find-all Domain for theDomain in {allDomains} do {allClasses} = theDomain -> R2.Class for theClass in {allClasses} do [] = generateCode [] on theClass endfor endfor UML Metamodel PIM Instantiate Define Mapping Apply Mapping PSI Metamodel PSI
Architecture Centric Metamodels {allNodes} =  find-all Node for theNode in {allNodes} do {allProcesses} = theNode -> R2.Process for theProcess in {allProcesses} do [] = generateCode [] on theProcess endfor endfor UML Metamodel PIM Instantiate PSM Metamodel Define Mapping PSM Apply Mapping PSI Metamodel Define Mapping PSI Apply Mapping In architecture centric metamodels,  the “generateCode” method iterates over the  contents of the PSM  (i.e. architecture) meta-models….
The Platform Metamodel ,[object Object],[object Object],[object Object],[object Object]
Two Stage Transformation ,[object Object],[object Object],[object Object],[object Object],Action Language xUML Formalism MDA Process Build Sets Platform Code
Platform Domain ,[object Object],This metamodel holds the PIM-PSM mappings Data Distribution Code Distribution
Code and Data Distribution: Consequences ,[object Object],Data Distribution Code Distribution Data Distribution across processes gives rise to the need for data protection, to guard against multiple concurrent accesses
Distributing PIM Code: Inter-Process Operation Calls ,[object Object],Client Process Server Process A B A calls remote B B Stub B Skeleton Communication Middleware 2. B Stub packs Input parameters and calls IPC send 5. B Skeleton packs output parameters and calls IPC send 6. B Stub unpacks output parameters 3. B Skeleton unpacks input parameters 1.  A calls B stub with input parameters : later, B stub returns output parameters 4. B Skeleton calls B with input parameters, B returns output parameters
Distributing PIM Data: Automatic Object Locking  ,[object Object],R1 xUML Runtime Model this.latitude = newLat this.longitude = newLong Target latitude longitude Weapon status myTarget = this -> R1.Target targetLat = myTarget.latitude targetLong = myTarget.longitude Automatically generated calls to xUML runtime obtain write semaphore (Target) here release write semaphore (Target) here obtain read semaphore (Target) here release read semaphore (Target) here
Complexity Simplified ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
xUML Centric vs. Architecture Centric ,[object Object],[object Object],[object Object],xUML centric Architecture centric {allDomains} = find-all Domain for theDomain in {allDomains} do {allClasses} = theDomain -> R2.Class for theClass in {allClasses} do [] = generateCode [] on theClass endfor endfor {allNodes} = find-all Node for theNode in {allNodes} do {allProcesses} = theNode -> R2.Process for theProcess in {allProcesses} do [] = generateCode [] on theProcess endfor endfor
Portable Architectures
Adaptation Layer on the Domain Model ,[object Object],[object Object],[object Object],platform-specific implementation platform-independent interface Generated Code xUML Runtime Layer Generated System Adaptation Layer
Runtime Metamodel Generated System This metamodel holds the PSM-PSI mappings Generated Code xUML Runtime Layer Adaptation Layer
Adaptation Layer Interfaces ,[object Object],[object Object],Run Time Specific Adaption Layer Generated Code xUML Runtime Layer Generated System Adaptation Layer
Reuse of Mappings
MDA Limits the Impact of Business Rule and Technology Changes UML Metamodel Platform & implementation environment changes impact only here PIM Instantiate Business rule & requirement changes impact only here Manual or Automated PSM Metamodel Define Mapping PSM Apply Mapping PSI Metamodel Define Mapping PSI Apply Mapping
Reusable Mappings Are Defined at the Metamodel Level (part of) UML Metamodel Class Attribute Signal PSM Metamodel PSI Metamodel Define Mapping xUML Metamodel Define Mapping (part of) PSM Metamodel (object-based) Class PrivateDatum PublicMethod (part of)  Ada 83 Metamodel Package BodyVariable SpecSubprogram
Reusable Mappings Are Defined at the Metamodel Level (part of) UML Metamodel Class Attribute Signal PSM Metamodel PSI Metamodel Define Mapping xUML Metamodel Define Mapping (part of) PSM Metamodel (object-based) Class PrivateDatum PublicMethod (part of)  Java Metamodel Class Attribute Operation
The Code Structure Domain ,[object Object],[object Object]
The Code Structure Domain ,[object Object],[object Object]
The Code Structure Domain
Summary
Summary ,[object Object],[object Object]
Maintainability vs. Executability PSM (UML) manually build a  Platform Specific Model … manually code a  Platform Specific Implementation PSI (Code) manually build a  Platform Independent Model … PIM (UML) Elaborate Compromise between maintainability and executability In classic approaches, the PSI (code) must be built to be maintainable, typically by incorporating  layering  and  encapsulation … …which have a detrimental effect on speed and size of the executing system PSI (Code) automatically generate a  Platform Specific Implementation  using PIM-PSI mappings manually build a  Platform Independent Model … PIM (xUML) Translate Built for executability Built for maintainability In translation-based approaches, the maintained entity (the PIM) is  built for maintainability  with layering and encapsulation… … while the executable entity (the PSI) is  optimized for execution efficiency
The End A Practical Guide to Code Generation using Model Driven Architecture and Executable UML  25 Jun 2008 Chris Raistrick, Kennedy Carter [email_address] KC.COM

More Related Content

Similar to Code Generation with MDA and xUML

xUMLFinalPresentation.ppt
xUMLFinalPresentation.pptxUMLFinalPresentation.ppt
xUMLFinalPresentation.ppt
ssuser2ef938
 
GNAT Pro User Day: QGen: Simulink® static verification and code generation
GNAT Pro User Day: QGen: Simulink® static verification and code generationGNAT Pro User Day: QGen: Simulink® static verification and code generation
GNAT Pro User Day: QGen: Simulink® static verification and code generation
AdaCore
 
QGen GNAT Industrial User Day
QGen GNAT Industrial User DayQGen GNAT Industrial User Day
QGen GNAT Industrial User Day
matteobordinadacore
 
Constructing DSMLs
Constructing DSMLsConstructing DSMLs
Constructing DSMLs
miso_uam
 
Rhapsody Software
Rhapsody SoftwareRhapsody Software
Rhapsody Software
Bill Duncan
 
RTI-CODES+ISSS-2012-Submission-1
RTI-CODES+ISSS-2012-Submission-1RTI-CODES+ISSS-2012-Submission-1
RTI-CODES+ISSS-2012-Submission-1
Serge Amougou
 
agile architecture - two hour presentation - two worked examples
agile architecture  - two hour presentation - two worked examplesagile architecture  - two hour presentation - two worked examples
agile architecture - two hour presentation - two worked examples
Mark Collins-Cope
 
Bip Design Flow
Bip Design FlowBip Design Flow
Bip Design Flow
Simon Bliudze
 
Integrating Performance Modeling in Industrial Automation through AutomationM...
Integrating Performance Modeling in Industrial Automation through AutomationM...Integrating Performance Modeling in Industrial Automation through AutomationM...
Integrating Performance Modeling in Industrial Automation through AutomationM...
Luca Berardinelli
 
ERTS_Unit 1_PPT.pdf
ERTS_Unit 1_PPT.pdfERTS_Unit 1_PPT.pdf
ERTS_Unit 1_PPT.pdf
VinothkumarUruman1
 
Graphical Model Transformation Framework
Graphical Model Transformation FrameworkGraphical Model Transformation Framework
Graphical Model Transformation Framework
Kaniska Mandal
 
Maximizing Efficiency Using Simulation
Maximizing Efficiency Using SimulationMaximizing Efficiency Using Simulation
Maximizing Efficiency Using Simulation
jason_cov
 
Build 2019 Recap
Build 2019 RecapBuild 2019 Recap
Build 2019 Recap
Eran Stiller
 
Whats new in_mlflow
Whats new in_mlflowWhats new in_mlflow
Whats new in_mlflow
Databricks
 
IBM SmartCloud Orchestration
IBM SmartCloud OrchestrationIBM SmartCloud Orchestration
IBM SmartCloud Orchestration
IBM Danmark
 
How to Create Your Own Product-Modeling Environment
How to Create Your Own Product-Modeling EnvironmentHow to Create Your Own Product-Modeling Environment
How to Create Your Own Product-Modeling Environment
Tim Geisler
 
WML SNAP ML
WML SNAP MLWML SNAP ML
Serverless machine learning architectures at Helixa
Serverless machine learning architectures at HelixaServerless machine learning architectures at Helixa
Serverless machine learning architectures at Helixa
Data Science Milan
 
Presentation on Behavioral Synthesis & SystemC
Presentation on Behavioral Synthesis & SystemCPresentation on Behavioral Synthesis & SystemC
Presentation on Behavioral Synthesis & SystemC
Mukit Ahmed Chowdhury
 
Practical Experiences Migrating Unified Modeling Language Models to IBM® Rati...
PracticalExperiences Migrating Unified Modeling Language Models to IBM® Rati...PracticalExperiences Migrating Unified Modeling Language Models to IBM® Rati...
Practical Experiences Migrating Unified Modeling Language Models to IBM® Rati...
Einar Karlsen
 

Similar to Code Generation with MDA and xUML (20)

xUMLFinalPresentation.ppt
xUMLFinalPresentation.pptxUMLFinalPresentation.ppt
xUMLFinalPresentation.ppt
 
GNAT Pro User Day: QGen: Simulink® static verification and code generation
GNAT Pro User Day: QGen: Simulink® static verification and code generationGNAT Pro User Day: QGen: Simulink® static verification and code generation
GNAT Pro User Day: QGen: Simulink® static verification and code generation
 
QGen GNAT Industrial User Day
QGen GNAT Industrial User DayQGen GNAT Industrial User Day
QGen GNAT Industrial User Day
 
Constructing DSMLs
Constructing DSMLsConstructing DSMLs
Constructing DSMLs
 
Rhapsody Software
Rhapsody SoftwareRhapsody Software
Rhapsody Software
 
RTI-CODES+ISSS-2012-Submission-1
RTI-CODES+ISSS-2012-Submission-1RTI-CODES+ISSS-2012-Submission-1
RTI-CODES+ISSS-2012-Submission-1
 
agile architecture - two hour presentation - two worked examples
agile architecture  - two hour presentation - two worked examplesagile architecture  - two hour presentation - two worked examples
agile architecture - two hour presentation - two worked examples
 
Bip Design Flow
Bip Design FlowBip Design Flow
Bip Design Flow
 
Integrating Performance Modeling in Industrial Automation through AutomationM...
Integrating Performance Modeling in Industrial Automation through AutomationM...Integrating Performance Modeling in Industrial Automation through AutomationM...
Integrating Performance Modeling in Industrial Automation through AutomationM...
 
ERTS_Unit 1_PPT.pdf
ERTS_Unit 1_PPT.pdfERTS_Unit 1_PPT.pdf
ERTS_Unit 1_PPT.pdf
 
Graphical Model Transformation Framework
Graphical Model Transformation FrameworkGraphical Model Transformation Framework
Graphical Model Transformation Framework
 
Maximizing Efficiency Using Simulation
Maximizing Efficiency Using SimulationMaximizing Efficiency Using Simulation
Maximizing Efficiency Using Simulation
 
Build 2019 Recap
Build 2019 RecapBuild 2019 Recap
Build 2019 Recap
 
Whats new in_mlflow
Whats new in_mlflowWhats new in_mlflow
Whats new in_mlflow
 
IBM SmartCloud Orchestration
IBM SmartCloud OrchestrationIBM SmartCloud Orchestration
IBM SmartCloud Orchestration
 
How to Create Your Own Product-Modeling Environment
How to Create Your Own Product-Modeling EnvironmentHow to Create Your Own Product-Modeling Environment
How to Create Your Own Product-Modeling Environment
 
WML SNAP ML
WML SNAP MLWML SNAP ML
WML SNAP ML
 
Serverless machine learning architectures at Helixa
Serverless machine learning architectures at HelixaServerless machine learning architectures at Helixa
Serverless machine learning architectures at Helixa
 
Presentation on Behavioral Synthesis & SystemC
Presentation on Behavioral Synthesis & SystemCPresentation on Behavioral Synthesis & SystemC
Presentation on Behavioral Synthesis & SystemC
 
Practical Experiences Migrating Unified Modeling Language Models to IBM® Rati...
PracticalExperiences Migrating Unified Modeling Language Models to IBM® Rati...PracticalExperiences Migrating Unified Modeling Language Models to IBM® Rati...
Practical Experiences Migrating Unified Modeling Language Models to IBM® Rati...
 

Recently uploaded

Operating System Used by Users in day-to-day life.pptx
Operating System Used by Users in day-to-day life.pptxOperating System Used by Users in day-to-day life.pptx
Operating System Used by Users in day-to-day life.pptx
Pravash Chandra Das
 
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
SitimaJohn
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Tosin Akinosho
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
Jason Packer
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
ssuserfac0301
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
panagenda
 
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Tatiana Kojar
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Alpen-Adria-Universität
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
Tatiana Kojar
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
saastr
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Wask
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
Hiroshi SHIBATA
 
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
alexjohnson7307
 
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdfNunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
flufftailshop
 
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Jeffrey Haguewood
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
Ivanti
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
Recommendation System using RAG Architecture
Recommendation System using RAG ArchitectureRecommendation System using RAG Architecture
Recommendation System using RAG Architecture
fredae14
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
Jakub Marek
 

Recently uploaded (20)

Operating System Used by Users in day-to-day life.pptx
Operating System Used by Users in day-to-day life.pptxOperating System Used by Users in day-to-day life.pptx
Operating System Used by Users in day-to-day life.pptx
 
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
 
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
 
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
 
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdfNunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
 
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
Recommendation System using RAG Architecture
Recommendation System using RAG ArchitectureRecommendation System using RAG Architecture
Recommendation System using RAG Architecture
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
 

Code Generation with MDA and xUML

  • 1. Welcome A Practical Guide to Code Generation using Model Driven Architecture and Executable UML 25 Jun 2008 Chris Raistrick, Kennedy Carter [email_address] KC.COM
  • 2.
  • 4.
  • 5. Elaboration Based Process The deliverables are up to 300% redundant… … and maintenance costs are correspondingly high Requirements (Text / Use Cases) This must be changed… or become obsolete This must be changed… or become obsolete This must be changed When this changes manually build a Platform Specific Model … PSM (UML) manually code a Platform Specific Implementation PSI (Ada/C++) manually build a Platform Independent Model … PIM (UML) Process definition Design policies Imp’n rules
  • 6. Elaboration vs. Translation PSM (UML) Process definition Design policies Coding rules manually code a Platform Specific Implementation PSI (Ada/C++) manually build a Platform Independent Model … PIM (UML) Elaborate Translate manually build a Platform Specific Model … PSI (Ada/C/C++) automatically generate a Platform Specific Implementation using PIM-PSI mappings PIM-PSI Mappings (xUML) manually specify mappings onto the platform … manually build a Platform Independent Model … PIM (xUML) Requirement Change impact Technology Change impact
  • 7. Translation Based Process Translate The knowledge in the heads of developers is: - Formalized - Accessible - Reusable - Refinable Process definition Design policies Coding rules PSI (Ada/C/C++) automatically generate a Platform Specific Implementation using PIM-PSI mappings PIM-PSI Mappings (xUML) manually specify mappings onto the platform … manually build a Platform Independent Model … PIM (xUML)
  • 8. Formalized Application and Software Design Expertise PIM-PSI Mappings (xUML) automatically generate a Platform Specific Implementation using PIM-PSI mappings manually specify mappings onto the platform … manually build a Platform Independent Model … PIM (xUML) Rules and policies for organising aircraft Process definition Design policies Coding rules PSI (Code) Rules and policies for organising software
  • 10.
  • 11. The xUML Model Structure System Model Domains Classes Operations States xUML Model (PIM) Platform-Specific Configuration
  • 12.
  • 13. Metamodel Based Code Generation
  • 14. The Code Generator: Domains Populate Generate System Model Code Generator Generated Code xUML Runtime Layer Generated System Adaptation Layer The code generator itself is a set of domain models expressed using xUML. The domains represent the various components of an xUML system. (Part of) Code Generator Domain Chart xUML Model (PIM) Platform-Specific Configuration xUML-Code Mappings iCCG Code Generator
  • 15. The Code Generator: Classes and Methods (Part of) Configurable Code Generator Domain Chart iCCG Code Generator Code Generator xUML-Code Mappings (Part of) Executable UML Class Model the classes in each domain represent the elements that make up those components. Method to Generate Java Method to Generate Ada Method to Generate C++ Method to Generate C … $FORMAT header_file typedef struct C[I:this.class_ID]_struct { /* "[T:this.class_name]" Class Header */ struct s_object *next_instance; $ENDFORMAT … Each element contains operations which specify how to map that xUML element onto a specific target language.
  • 16.
  • 17. Instantiate the Formalism Metamodel Domain Instance Class Instances Attribute Instances Populated Executable UML Class Model When the Executable UML domain is populated with the PIM components, we see these instances… Populate xUML Model (PIM) Platform-Specific Configuration System Model xUML-Code Mappings iCCG Code Generator Code Generator
  • 18. The Metamodels Embody the Code Generation Rules Domain.generateCode Class.generateCode Attribute.generateCode The task of translation involves iterating through these instances and generating suitable code from them. iCCG Code Generator Code Generator xUML-Code Mappings
  • 19. Generate the Code Platform Independent Model : Class Diagram Generated C Code Generate Generate xUML-Code Mappings iCCG Code Generator Code Generator Generated Code xUML Runtime Layer Generated System Adaptation Layer
  • 20. We have illustrated generation of data structures from the class model. The process of generating code from the action language is the same, and based upon populating and translating instances in the “Action Language” domain… Generating Code from Action Language Note that the “generateCode” operation of the “ASL Statement” class is polymorphic, allowing us to implement rival versions of this method for each type of ASL statement, represented as the subclasses “Create Statement”, “Delete Statement” and so on polymorphic operation with different polymorphic methods to generate code for each different ASL statement
  • 21. Generate the Code Generator Project Code Generator Pre-Existing Code Generator Project Domain Models Project Code Code Generator PIM (part of) xUML Metamodel Domain Class Attribute xUML Metamodels xUML to Code Mappings in ASL
  • 22. Code Generation Overview Populate Generate xUML Model (PIM) Platform-Specific Configuration System Model xUML-Code Mappings iCCG Code Generator Code Generator Generated Code xUML Runtime Layer Generated System Adaptation Layer PLATFORM SPECIFIC CONFIGURATION FILE PROCESS "Process One" ONE 1 127.0.0.1 1000 1600 PROCESS "Process Two" TWO 1 127.0.0.1 1001 1601 CLASS-PROCESS WM TGT ONE CLASS-PROCESS WM WPN TWO (part of) xUML Metamodel Domain Class Attribute owning_domain = this -> R2 $FORMAT header_file typedef struct D[I:owning_domain.domain_ID]_C[I:this.class_ID]_struct { /* "[T:this.class_name]" Class Header */ struct s_object *next_instance; /* Linked list of */ struct s_object *prev_instance; /* object instances */ struct s_object *rel_ptr; /* list of rel'ns */ struct s_object *cpr_ptr; /* list of cp rel'ns */ $ENDFORMAT {attributes_in_class} = this -> R3 for the_attribute in {attributes_in_class} do [] = ATT1:generateCode [header_file] on the_attribute endfor $FORMAT header_file }; $ENDFORMAT Multi-node multi-process runtime Windows Vista adaptation layer
  • 24.
  • 25.
  • 26.
  • 27.
  • 28. Optimized Instance Handles The first element is a status indicator: 0 means “undefined”, 1 means “defined”. The second element (which is defined only if the first element is 1) is an index into the attribute arrays of the object it references, i.e. an object “pointer”. An instance handle can be realised as a 2-element array of integers. Instance attributes can be realised as fixed-length arrays, with a flag for each index to indicate whether that instance exists Customer custId custName custAddress
  • 29. Optimized Associations note that creating and deleting objects and links does not involve any dynamic memory management… … even though there are ‘create’ and ‘delete’ statements in the PIM A binary association is implemented as two 2-dimensional arrays. Each array implements the association in one direction only. Customer End Account End Customer 0 owns Account 2 Account 6 is owned by Customer 2 accountId dateOpened balance ownerId status Account owns is owned by 1..* 0..1 R1 Customer custId custName custAddress
  • 31.
  • 32.
  • 33. Architecture Centric Metamodels {allNodes} = find-all Node for theNode in {allNodes} do {allProcesses} = theNode -> R2.Process for theProcess in {allProcesses} do [] = generateCode [] on theProcess endfor endfor UML Metamodel PIM Instantiate PSM Metamodel Define Mapping PSM Apply Mapping PSI Metamodel Define Mapping PSI Apply Mapping In architecture centric metamodels, the “generateCode” method iterates over the contents of the PSM (i.e. architecture) meta-models….
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 43.
  • 44. Runtime Metamodel Generated System This metamodel holds the PSM-PSI mappings Generated Code xUML Runtime Layer Adaptation Layer
  • 45.
  • 47. MDA Limits the Impact of Business Rule and Technology Changes UML Metamodel Platform & implementation environment changes impact only here PIM Instantiate Business rule & requirement changes impact only here Manual or Automated PSM Metamodel Define Mapping PSM Apply Mapping PSI Metamodel Define Mapping PSI Apply Mapping
  • 48. Reusable Mappings Are Defined at the Metamodel Level (part of) UML Metamodel Class Attribute Signal PSM Metamodel PSI Metamodel Define Mapping xUML Metamodel Define Mapping (part of) PSM Metamodel (object-based) Class PrivateDatum PublicMethod (part of) Ada 83 Metamodel Package BodyVariable SpecSubprogram
  • 49. Reusable Mappings Are Defined at the Metamodel Level (part of) UML Metamodel Class Attribute Signal PSM Metamodel PSI Metamodel Define Mapping xUML Metamodel Define Mapping (part of) PSM Metamodel (object-based) Class PrivateDatum PublicMethod (part of) Java Metamodel Class Attribute Operation
  • 50.
  • 51.
  • 54.
  • 55. Maintainability vs. Executability PSM (UML) manually build a Platform Specific Model … manually code a Platform Specific Implementation PSI (Code) manually build a Platform Independent Model … PIM (UML) Elaborate Compromise between maintainability and executability In classic approaches, the PSI (code) must be built to be maintainable, typically by incorporating layering and encapsulation … …which have a detrimental effect on speed and size of the executing system PSI (Code) automatically generate a Platform Specific Implementation using PIM-PSI mappings manually build a Platform Independent Model … PIM (xUML) Translate Built for executability Built for maintainability In translation-based approaches, the maintained entity (the PIM) is built for maintainability with layering and encapsulation… … while the executable entity (the PSI) is optimized for execution efficiency
  • 56. The End A Practical Guide to Code Generation using Model Driven Architecture and Executable UML 25 Jun 2008 Chris Raistrick, Kennedy Carter [email_address] KC.COM

Editor's Notes

  1. Make a sign. There are a number of slides that contain what might be called tedious but relevant detail. These were included for reference. My reserves of time, and I suspect your reserves of alertness, preclude detailed examination of these slides.
  2. Components are lovingly handcrafted Each is subjected to its own personal design and implementation process clearly nobody would build components like this. Look at all these tables…
  3. Imagine these are software engineers – which is quite hard. What happens if we take the classic analyse-design-code process in the context of MDA? Hard to swim up a waterfall What happens when a requirement changes? What happens to the PIM and PSM?
  4. Look how sunny it is on the right The more environmentally responsible among you will have noticed a problem with the right hand picture. It contains pollution. However, this is due to an inappropriately selected piece of tacky clip art. As we shall see, MDA embodies its own anti-pollution policy.
  5. MDA is about formalisation of expertise…both application and technology expertise
  6. We can formalise the rules and policies about how we organise our software… …in exactly the same way that we formalise rules about how we organise aircraft… by building executable UML models of those two domains Design is just a subject matter for analysis.
  7. The primary deliverable in this approach to MDA is the PIM. It is here that all rules and policies are defined. It is here that requirement changes are reflected. The PSM and the PSI are merely derived products.
  8. We build a PIM that is technology agnostic, but this can be accompanied by platform-specific configuration data to influence the code generation process. The xUML Runtime layer provides the xUML virtual machine. It may not be present in highly compact targets. The adaptation layer provides services to map onto the underlying platform – operating system, language and middleware.
  9. This process is predicated on the need to build precise, executable models. This precludes use of highly complex, semantically ambiguous notations (such as UML 2.x) Executable UML is a precise proper subset of UML, composed of a small set of simple notations, organised in a predictable and simple way.
  10. Much of the complexity of UML 2.x exists because of the need to build PSMs, in which we must concern ourselves with: different types of communication data structures code structures (e.g. friends) node boundaries sw engineers have a long track record of migrating to more abstract formalisms
  11. The code generator is just a set of domains… …representing the components to be mapped… …with embedded mappings Let’s walk through the steps of this process
  12. This is an executable model of our code generation rules. When we generate code from this model, we get a code generator!
  13. So our PIM is now just data – even the code!
  14. To generate code for a domain, we write a “generateCode” operation on the Domain class… …which iterates across all classes… etc
  15. In the olden days, we used to pile all our data into a global area and systematically rape and plunder it at will. Not pretty, but very fast.
  16. If we have a complex implementation architecture, we do what all modellers do with complex things… …we model them. Here we have a model of the PSM components.
  17. All this extra complexity would typically end up in the model, but with this approach the model can be kept in its simnplest form.
  18. Design is just another subject matter for analysis
  19. What characteristics, what constraints? - select a paradigm.