SlideShare a Scribd company logo
1 of 21
Valerio Cosentino
Massimo Tisi
Javier Luis Canovas Izquierdo
SOFSEM, 2015, Pec pod Sněžkou, Czech Republic
A Model-Driven Approach to Generate
External DSLs from Object-Oriented
APIs
1© AtlanMod - atlanmod-contact@mines-nantes.fr
Outline
 Introduction
 Model Driven Engineering
 From API to DSL
 Conclusion and Future work
2© AtlanMod - atlanmod-contact@mines-nantes.fr
Introduction
 Code abstraction and reuse allow the use of
existing software knowledge (i.e., code
libraries) to build new software by reducing:
– Time
– Resources
– Redundancy
 Code libraries can be accessed via:
– APIs using mechanisms (function call, class
inheritance, etc.) provided by the General-
purpose Programming Language (GPL)
– DSLs (Domain Specific Languages)
3© AtlanMod - atlanmod-contact@mines-nantes.fr
Introduction
 API vs DSL:
4© AtlanMod - atlanmod-contact@mines-nantes.fr
Introduction
 Are DSLs better than APIs?[1]
– Pros:
 DSLs can be more expressive,
maintainable, concise and readable
 Static validation, syntax highlighting, etc.
 Interpretation/compilation optimized for
the DSL code execution
– Cons:
 DSLs requires a higher development
cost
[1] Kelly, S., Tolvanen, J.P.: Domain-Specific Modeling: Enabling Full Code
Generation. Wiley IEEE Computer (2008)
5© AtlanMod - atlanmod-contact@mines-nantes.fr
Introduction
 How to reduce the development cost when
building a DSL?
– Model Driven Engineering (MDE)
 Automatic generation of DSL
components:
– compiler, validator, development
environment
6© AtlanMod - atlanmod-contact@mines-nantes.fr
Model Driven Engineering
 What is MDE?
– Models: first class entities in MDE (abstract
representation of the knowledge for a given domain)
– Model transformations: operaration for model handling
 Injectors/extractors to move between technical spaces [2]
[2] Kurtev, I., Bezivin, J., Aksit, M.: Technological Spaces : an Initial
Appraisal. In: DOA. (2002) 1–6
7© AtlanMod - atlanmod-contact@mines-nantes.fr
From API to DSL
8© AtlanMod - atlanmod-contact@mines-nantes.fr
From API to DSL
9© AtlanMod - atlanmod-contact@mines-nantes.fr
From API to DSL
10© AtlanMod - atlanmod-contact@mines-nantes.fr
API classes to API metamodel
 Mapping[3]
– API class definitions  metamodel elements
– Java classes  metaclasses
 Attributes  metaclass attributes
 Methods  operations
 Customization:
– Some APIs can generate very large
metamodels
 Selection of a subset of API elements
– Tunable API metamodel
 Manual modifications
[3] Canovas Izquierdo, J.L., Jouault, F., Cabot, J., Garcıa Molina, J.:
API2MoL: Automating the building of bridges between APIs and Model-
Driven Engineering. Inform. Software Tech. 54(0) (2012) 257–273
11© AtlanMod - atlanmod-contact@mines-nantes.fr
From API to DSL
12© AtlanMod - atlanmod-contact@mines-nantes.fr
API metamodel to DSL metamodel
 Domain-specific concepts extracted from the
API metamodel
 Domain-independent API structure
– Templates
13© AtlanMod - atlanmod-contact@mines-nantes.fr
Templates
 Plain Old Data (POD)
– For simple APIs to create and maintain a
data structure
– API classes composed by getters, setters
and constructors
14© AtlanMod - atlanmod-contact@mines-nantes.fr
Templates
 Fluent
– For APIs that rely on chaining method calls
– The return values of the method calls
(keywords) are used to structure the DSL
15© AtlanMod - atlanmod-contact@mines-nantes.fr
Templates
 SimpleJava
– For APIs that do not fit in the previous
categories
– Java sub-set(statements, declarations, etc.)
16© AtlanMod - atlanmod-contact@mines-nantes.fr
From API to DSL
17© AtlanMod - atlanmod-contact@mines-nantes.fr
DSL metamodel to DSL tooling
 Bridge between the Model TS and the Grammar TS
– Mapping of metamodel elements into the grammar
rules
– Development environment
 The generation process is parameterized by:
– The DSL metamodel (concepts, attributes,
references, cardinalities, etc.)
– The template chosen (the grammar structure, the
development environment and compiler)
– Particularized for Xtext[4]
[4] Eysholdt, M., Behrens, H.: Xtext: implement your language faster than
the quick and dirty way. In: SPLASH. (2010) 307–309
18© AtlanMod - atlanmod-contact@mines-nantes.fr
From API to DSL
19© AtlanMod - atlanmod-contact@mines-nantes.fr
Compiler generation
 Since the semantics of the DSL template is
known, a DSL instance can be transformed
into its equivalent in Java
– SimpleJava
 DSL concepts have a one-to-one
correspondence with Java constructs
 DSL model to Java model (MoDisco[5])
 Java model to Java readable file (Acceleo[6])
[5] http://www.eclipse.org/gmt/modisco/technologies/J2SE5/
|6] http://www.eclipse.org/acceleo
20© AtlanMod - atlanmod-contact@mines-nantes.fr
Conclusion and Future work
 MDE approach to connect API, Model and Grammar
technical spaces
 Template mechanism to generate the resulting DSL
 Proof of concept
 Future work:
– Identify more templates to cover other types of
DSLs (API characterization)
– Study how our method could cope with more
complex APIs (event-driven, concurrent, etc.)
– Explore how distinct APIs used in the same GPL can
be combined at DSL-level (interleaving DSLs)
21© AtlanMod - atlanmod-contact@mines-nantes.fr

More Related Content

What's hot

.NET Framework Overview
.NET Framework Overview.NET Framework Overview
.NET Framework Overview
Doncho Minkov
 
01 intro to programming in .net
01   intro to programming in .net01   intro to programming in .net
01 intro to programming in .net
Felisha Hosein
 

What's hot (10)

Leveraging Model-Driven Technologies for JSON Artefacts: The Shipyard Case Study
Leveraging Model-Driven Technologies for JSON Artefacts: The Shipyard Case StudyLeveraging Model-Driven Technologies for JSON Artefacts: The Shipyard Case Study
Leveraging Model-Driven Technologies for JSON Artefacts: The Shipyard Case Study
 
.Net language support
.Net language support.Net language support
.Net language support
 
.NET Framework Overview
.NET Framework Overview.NET Framework Overview
.NET Framework Overview
 
KamalTeja_CV
KamalTeja_CVKamalTeja_CV
KamalTeja_CV
 
Introduction of .net framework
Introduction of .net frameworkIntroduction of .net framework
Introduction of .net framework
 
The REMICS model-driven process for migrating legacy applications to the cloud
The REMICS model-driven process for migrating legacy applications to the cloudThe REMICS model-driven process for migrating legacy applications to the cloud
The REMICS model-driven process for migrating legacy applications to the cloud
 
.Net Framework
.Net Framework.Net Framework
.Net Framework
 
01 intro to programming in .net
01   intro to programming in .net01   intro to programming in .net
01 intro to programming in .net
 
CG2010 Tailored Code Generators
CG2010 Tailored Code GeneratorsCG2010 Tailored Code Generators
CG2010 Tailored Code Generators
 
The secret life of rules in Software Engineering
The secret life of rules in Software EngineeringThe secret life of rules in Software Engineering
The secret life of rules in Software Engineering
 

Viewers also liked

Extracting Business Rules from COBOL: A Model-Based Framework
Extracting Business Rules from COBOL: A Model-Based FrameworkExtracting Business Rules from COBOL: A Model-Based Framework
Extracting Business Rules from COBOL: A Model-Based Framework
Valerio Cosentino
 
A Model Driven Reverse Engineering framework for extracting business rules ou...
A Model Driven Reverse Engineering framework for extracting business rules ou...A Model Driven Reverse Engineering framework for extracting business rules ou...
A Model Driven Reverse Engineering framework for extracting business rules ou...
RuleML
 
A Model Driven Reverse Engineering framework for extracting business rules ou...
A Model Driven Reverse Engineering framework for extracting business rules ou...A Model Driven Reverse Engineering framework for extracting business rules ou...
A Model Driven Reverse Engineering framework for extracting business rules ou...
Valerio Cosentino
 

Viewers also liked (7)

Extracting UML/OCL Integrity Constraints and Derived Types from Relational Da...
Extracting UML/OCL Integrity Constraints and Derived Types from Relational Da...Extracting UML/OCL Integrity Constraints and Derived Types from Relational Da...
Extracting UML/OCL Integrity Constraints and Derived Types from Relational Da...
 
Extracting Business Rules from COBOL: A Model-Based Framework
Extracting Business Rules from COBOL: A Model-Based FrameworkExtracting Business Rules from COBOL: A Model-Based Framework
Extracting Business Rules from COBOL: A Model-Based Framework
 
A Model Driven Reverse Engineering framework for extracting business rules ou...
A Model Driven Reverse Engineering framework for extracting business rules ou...A Model Driven Reverse Engineering framework for extracting business rules ou...
A Model Driven Reverse Engineering framework for extracting business rules ou...
 
Gitana: a SQL-based Git Repository Inspector
Gitana: a SQL-based Git Repository InspectorGitana: a SQL-based Git Repository Inspector
Gitana: a SQL-based Git Repository Inspector
 
Assessing the Bus Factor of Git Repositories
Assessing the Bus Factor of Git RepositoriesAssessing the Bus Factor of Git Repositories
Assessing the Bus Factor of Git Repositories
 
A Model Driven Reverse Engineering framework for extracting business rules ou...
A Model Driven Reverse Engineering framework for extracting business rules ou...A Model Driven Reverse Engineering framework for extracting business rules ou...
A Model Driven Reverse Engineering framework for extracting business rules ou...
 
Hype vs. Reality: The AI Explainer
Hype vs. Reality: The AI ExplainerHype vs. Reality: The AI Explainer
Hype vs. Reality: The AI Explainer
 

Similar to A Model-Driven Approach to Generate External DSLs from Object-Oriented APIs

jeevanreddy-nwplm
jeevanreddy-nwplmjeevanreddy-nwplm
jeevanreddy-nwplm
jeevan b
 
Software Factories in the Real World: How an IBM WebSphere Integration Factor...
Software Factories in the Real World: How an IBM WebSphere Integration Factor...Software Factories in the Real World: How an IBM WebSphere Integration Factor...
Software Factories in the Real World: How an IBM WebSphere Integration Factor...
ghodgkinson
 
Resume_Dimitri_Dey_LTE_Android_Gmail
Resume_Dimitri_Dey_LTE_Android_GmailResume_Dimitri_Dey_LTE_Android_Gmail
Resume_Dimitri_Dey_LTE_Android_Gmail
Dimitri Dey
 
Srinivasan resume updated
Srinivasan resume updatedSrinivasan resume updated
Srinivasan resume updated
Srinivasan V N
 

Similar to A Model-Driven Approach to Generate External DSLs from Object-Oriented APIs (20)

Our research lines on Model-Driven Engineering and Software Engineering
Our research lines on Model-Driven Engineering and Software EngineeringOur research lines on Model-Driven Engineering and Software Engineering
Our research lines on Model-Driven Engineering and Software Engineering
 
Introducing Eclipse MoDisco
Introducing Eclipse MoDiscoIntroducing Eclipse MoDisco
Introducing Eclipse MoDisco
 
ACM SIGCHI EICS-2019 Keynote. Quid, Pedro J. Molina
ACM SIGCHI EICS-2019 Keynote. Quid, Pedro J. MolinaACM SIGCHI EICS-2019 Keynote. Quid, Pedro J. Molina
ACM SIGCHI EICS-2019 Keynote. Quid, Pedro J. Molina
 
Documentum Spring Data
Documentum Spring DataDocumentum Spring Data
Documentum Spring Data
 
jeevanreddy-nwplm
jeevanreddy-nwplmjeevanreddy-nwplm
jeevanreddy-nwplm
 
Prasad_CTP
Prasad_CTPPrasad_CTP
Prasad_CTP
 
Software Factories in the Real World: How an IBM WebSphere Integration Factor...
Software Factories in the Real World: How an IBM WebSphere Integration Factor...Software Factories in the Real World: How an IBM WebSphere Integration Factor...
Software Factories in the Real World: How an IBM WebSphere Integration Factor...
 
Resume_Dimitri_Dey_LTE_Android_Gmail
Resume_Dimitri_Dey_LTE_Android_GmailResume_Dimitri_Dey_LTE_Android_Gmail
Resume_Dimitri_Dey_LTE_Android_Gmail
 
Csit77404
Csit77404Csit77404
Csit77404
 
Resume
ResumeResume
Resume
 
DDS Advanced Tutorial - OMG June 2013 Berlin Meeting
DDS Advanced Tutorial - OMG June 2013 Berlin MeetingDDS Advanced Tutorial - OMG June 2013 Berlin Meeting
DDS Advanced Tutorial - OMG June 2013 Berlin Meeting
 
Vimala_Gadegi
Vimala_GadegiVimala_Gadegi
Vimala_Gadegi
 
ALT
ALTALT
ALT
 
Greg Maxey - Electric Cloud - Process as Code: An Introduction to the Electri...
Greg Maxey - Electric Cloud - Process as Code: An Introduction to the Electri...Greg Maxey - Electric Cloud - Process as Code: An Introduction to the Electri...
Greg Maxey - Electric Cloud - Process as Code: An Introduction to the Electri...
 
Source-to-source transformations: Supporting tools and infrastructure
Source-to-source transformations: Supporting tools and infrastructureSource-to-source transformations: Supporting tools and infrastructure
Source-to-source transformations: Supporting tools and infrastructure
 
Srinivasan resume updated
Srinivasan resume updatedSrinivasan resume updated
Srinivasan resume updated
 
PHP modernization approach generating KDM models from PHP legacy code
PHP modernization approach generating KDM models from PHP legacy codePHP modernization approach generating KDM models from PHP legacy code
PHP modernization approach generating KDM models from PHP legacy code
 
A Software Factory Integrating Rational & WebSphere Tools
A Software Factory Integrating Rational & WebSphere ToolsA Software Factory Integrating Rational & WebSphere Tools
A Software Factory Integrating Rational & WebSphere Tools
 
AlekyaNyalakonda_Resume
AlekyaNyalakonda_ResumeAlekyaNyalakonda_Resume
AlekyaNyalakonda_Resume
 
Session
SessionSession
Session
 

More from Valerio Cosentino

Gamification oss
Gamification ossGamification oss
Gamification oss
Valerio Cosentino
 

More from Valerio Cosentino (14)

Tracking counterfeiting on the web with python and ml
Tracking counterfeiting on the web with python and mlTracking counterfeiting on the web with python and ml
Tracking counterfeiting on the web with python and ml
 
GrimoireLab: Measuring the health of your software project with Python
GrimoireLab: Measuring the health of your software project with PythonGrimoireLab: Measuring the health of your software project with Python
GrimoireLab: Measuring the health of your software project with Python
 
Perceval, Graal and Arthur: The Quest for Software Project Data
Perceval, Graal and Arthur: The Quest for Software Project DataPerceval, Graal and Arthur: The Quest for Software Project Data
Perceval, Graal and Arthur: The Quest for Software Project Data
 
Gamification oss
Gamification ossGamification oss
Gamification oss
 
SortingHat: Wizardry on Software Project Members
SortingHat: Wizardry on Software Project MembersSortingHat: Wizardry on Software Project Members
SortingHat: Wizardry on Software Project Members
 
Measuring Software development with GrimoireLab
Measuring Software development with GrimoireLabMeasuring Software development with GrimoireLab
Measuring Software development with GrimoireLab
 
Graal The Quest for Source Code Knowledge
Graal  The Quest for Source Code KnowledgeGraal  The Quest for Source Code Knowledge
Graal The Quest for Source Code Knowledge
 
Measuring Software development with GrimoireLab
Measuring Software development with GrimoireLabMeasuring Software development with GrimoireLab
Measuring Software development with GrimoireLab
 
Crossminer and GrimoireLab
Crossminer and GrimoireLabCrossminer and GrimoireLab
Crossminer and GrimoireLab
 
Perceval: Software Project Data at Your Will
Perceval: Software Project Data at Your WillPerceval: Software Project Data at Your Will
Perceval: Software Project Data at Your Will
 
Extending grimoirelab
Extending grimoirelabExtending grimoirelab
Extending grimoirelab
 
Perceval
PercevalPerceval
Perceval
 
Gamification pres-scme-2017
Gamification pres-scme-2017Gamification pres-scme-2017
Gamification pres-scme-2017
 
A Model-Based Approach for Extracting Business Rules out of Legacy Informatio...
A Model-Based Approach for Extracting Business Rules out of Legacy Informatio...A Model-Based Approach for Extracting Business Rules out of Legacy Informatio...
A Model-Based Approach for Extracting Business Rules out of Legacy Informatio...
 

Recently uploaded

%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
masabamasaba
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
masabamasaba
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 

Recently uploaded (20)

tonesoftg
tonesoftgtonesoftg
tonesoftg
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
 

A Model-Driven Approach to Generate External DSLs from Object-Oriented APIs

  • 1. Valerio Cosentino Massimo Tisi Javier Luis Canovas Izquierdo SOFSEM, 2015, Pec pod Sněžkou, Czech Republic A Model-Driven Approach to Generate External DSLs from Object-Oriented APIs 1© AtlanMod - atlanmod-contact@mines-nantes.fr
  • 2. Outline  Introduction  Model Driven Engineering  From API to DSL  Conclusion and Future work 2© AtlanMod - atlanmod-contact@mines-nantes.fr
  • 3. Introduction  Code abstraction and reuse allow the use of existing software knowledge (i.e., code libraries) to build new software by reducing: – Time – Resources – Redundancy  Code libraries can be accessed via: – APIs using mechanisms (function call, class inheritance, etc.) provided by the General- purpose Programming Language (GPL) – DSLs (Domain Specific Languages) 3© AtlanMod - atlanmod-contact@mines-nantes.fr
  • 4. Introduction  API vs DSL: 4© AtlanMod - atlanmod-contact@mines-nantes.fr
  • 5. Introduction  Are DSLs better than APIs?[1] – Pros:  DSLs can be more expressive, maintainable, concise and readable  Static validation, syntax highlighting, etc.  Interpretation/compilation optimized for the DSL code execution – Cons:  DSLs requires a higher development cost [1] Kelly, S., Tolvanen, J.P.: Domain-Specific Modeling: Enabling Full Code Generation. Wiley IEEE Computer (2008) 5© AtlanMod - atlanmod-contact@mines-nantes.fr
  • 6. Introduction  How to reduce the development cost when building a DSL? – Model Driven Engineering (MDE)  Automatic generation of DSL components: – compiler, validator, development environment 6© AtlanMod - atlanmod-contact@mines-nantes.fr
  • 7. Model Driven Engineering  What is MDE? – Models: first class entities in MDE (abstract representation of the knowledge for a given domain) – Model transformations: operaration for model handling  Injectors/extractors to move between technical spaces [2] [2] Kurtev, I., Bezivin, J., Aksit, M.: Technological Spaces : an Initial Appraisal. In: DOA. (2002) 1–6 7© AtlanMod - atlanmod-contact@mines-nantes.fr
  • 8. From API to DSL 8© AtlanMod - atlanmod-contact@mines-nantes.fr
  • 9. From API to DSL 9© AtlanMod - atlanmod-contact@mines-nantes.fr
  • 10. From API to DSL 10© AtlanMod - atlanmod-contact@mines-nantes.fr
  • 11. API classes to API metamodel  Mapping[3] – API class definitions  metamodel elements – Java classes  metaclasses  Attributes  metaclass attributes  Methods  operations  Customization: – Some APIs can generate very large metamodels  Selection of a subset of API elements – Tunable API metamodel  Manual modifications [3] Canovas Izquierdo, J.L., Jouault, F., Cabot, J., Garcıa Molina, J.: API2MoL: Automating the building of bridges between APIs and Model- Driven Engineering. Inform. Software Tech. 54(0) (2012) 257–273 11© AtlanMod - atlanmod-contact@mines-nantes.fr
  • 12. From API to DSL 12© AtlanMod - atlanmod-contact@mines-nantes.fr
  • 13. API metamodel to DSL metamodel  Domain-specific concepts extracted from the API metamodel  Domain-independent API structure – Templates 13© AtlanMod - atlanmod-contact@mines-nantes.fr
  • 14. Templates  Plain Old Data (POD) – For simple APIs to create and maintain a data structure – API classes composed by getters, setters and constructors 14© AtlanMod - atlanmod-contact@mines-nantes.fr
  • 15. Templates  Fluent – For APIs that rely on chaining method calls – The return values of the method calls (keywords) are used to structure the DSL 15© AtlanMod - atlanmod-contact@mines-nantes.fr
  • 16. Templates  SimpleJava – For APIs that do not fit in the previous categories – Java sub-set(statements, declarations, etc.) 16© AtlanMod - atlanmod-contact@mines-nantes.fr
  • 17. From API to DSL 17© AtlanMod - atlanmod-contact@mines-nantes.fr
  • 18. DSL metamodel to DSL tooling  Bridge between the Model TS and the Grammar TS – Mapping of metamodel elements into the grammar rules – Development environment  The generation process is parameterized by: – The DSL metamodel (concepts, attributes, references, cardinalities, etc.) – The template chosen (the grammar structure, the development environment and compiler) – Particularized for Xtext[4] [4] Eysholdt, M., Behrens, H.: Xtext: implement your language faster than the quick and dirty way. In: SPLASH. (2010) 307–309 18© AtlanMod - atlanmod-contact@mines-nantes.fr
  • 19. From API to DSL 19© AtlanMod - atlanmod-contact@mines-nantes.fr
  • 20. Compiler generation  Since the semantics of the DSL template is known, a DSL instance can be transformed into its equivalent in Java – SimpleJava  DSL concepts have a one-to-one correspondence with Java constructs  DSL model to Java model (MoDisco[5])  Java model to Java readable file (Acceleo[6]) [5] http://www.eclipse.org/gmt/modisco/technologies/J2SE5/ |6] http://www.eclipse.org/acceleo 20© AtlanMod - atlanmod-contact@mines-nantes.fr
  • 21. Conclusion and Future work  MDE approach to connect API, Model and Grammar technical spaces  Template mechanism to generate the resulting DSL  Proof of concept  Future work: – Identify more templates to cover other types of DSLs (API characterization) – Study how our method could cope with more complex APIs (event-driven, concurrent, etc.) – Explore how distinct APIs used in the same GPL can be combined at DSL-level (interleaving DSLs) 21© AtlanMod - atlanmod-contact@mines-nantes.fr