SlideShare una empresa de Scribd logo
1 de 14
Descargar para leer sin conexión
Intro Proposal Evaluation Conclusion
Models from Code or Code as a Model?
Antonio García-Domínguez, Dimitris Kolovos
Aston University, University of York
OCL’16
October 2nd, 2016
A. García, D. S. Kolovos Models from Code or Code as a Model? 1 / 13
Intro Proposal Evaluation Conclusion
Using codebases to drive software engineering tasks
Usual sequence of events
We had a business need
We invested in developing a program that covered it
Now we may need to:
Extract architecture or underlying business process?
Find bugs before they hit us?
Improve its design?
Migrate it to a new technology?
Code is the most accurate description: let’s use it
How do we extract knowledge?
Regexps do not scale to complex tasks
We need something that understands the language
The “extractor” is embedded within a process
A. García, D. S. Kolovos Models from Code or Code as a Model? 2 / 13
Intro Proposal Evaluation Conclusion
Existing approaches
Some well-known reverse engineering tools (“extractors”)
Eclipse MoDisco: EMF-based, implements KDM/ASTM
JaMoPP: EMF-based, uses custom metamodel
Moose: FAMIX-based tool
Rascal: extracts partial JDT representation into a model
Issue: extractors are one-off processes
They produce standalone models: the code is no longer needed
However, current tools are not incremental: if the code is
changed, the extraction has to be redone from scratch
Issue: extractors are not query-aware
Some tasks will only access a small part of the codebase
Extracting the rest only adds overhead
A. García, D. S. Kolovos Models from Code or Code as a Model? 3 / 13
Intro Proposal Evaluation Conclusion
Epsilon EMC JDT driver: use IDE indices as models
IDEs already extract representations all the time
Eclipse indexes Java projects on the background
Keeps fast pointers to classes / methods
Extra info available on demand through parsing
JDT indices are under active improvement:
See Stefan Xenos’ talk on EclipseCon NA’16
Cross-pollination from CDT project (C++)
Faster, more thorough indexing coming in future releases
Our proposal: Epsilon EMC JDT driver
Expose code as seen by IDE (JDT) as a model
On-demand loading + direct access to Java classes
Sources available on GitHub (epsilonlabs/emc-jdt)
A. García, D. S. Kolovos Models from Code or Code as a Model? 4 / 13
Intro Proposal Evaluation Conclusion
Making it possible: Epsilon architecture
Epsilon Object Language (EOL) = JavaScript + OCL
Epsilon Model Connectivity (EMC)
Core
Model Validation (EVL) Code Generation (EGL)
Model-to-model Transformation (ETL) ...
Task-specific
languages
Technology-specific
drivers
Eclipse Modeling Framework (EMF) Schema-less XML
Eclipse Java Developer Tools (JDT) CSV ...
extends
implements
All Epsilon languages are based on EOL
EOL accesses models through EMC interfaces
By implementing the EMC interfaces, all Epsilon languages
can use JDT indices as models
A. García, D. S. Kolovos Models from Code or Code as a Model? 5 / 13
Intro Proposal Evaluation Conclusion
Configuration dialog for an EMC JDT model
A. García, D. S. Kolovos Models from Code or Code as a Model? 6 / 13
Intro Proposal Evaluation Conclusion
allInstances() in EMC JDT
Reflection-based X.allInstances
1 Parse Java sources in the projects on the fly
2 Traverse JDT Document Object Model with ASTVisitor
3 Use Java reflection to fetch instances of X
4 Cache for later executions, if desired
Special case: TypeDeclaration.allInstances
Searchable, lazy (no parsing unless looping over it)
Supports two new operations:
c.select(it|it.name = expr) searches with JDT the relevant
compilation unit, parses it and returns the right DOM node
c.search(it|it.name = expr) works the same, but it returns the
raw index entry (a simpler JDT SourceType)
A. García, D. S. Kolovos Models from Code or Code as a Model? 7 / 13
Intro Proposal Evaluation Conclusion
Case study: validate code against UML models
Overview
We are maintaining a library, and we need to check its
compliance with a UML model as it changes
Here, “compliance” means “must have all the classes and
methods in the UML model” (code may have more)
Which is faster/more convenient:
extracting a model with MoDisco first, or
checking it directly with the EMC JDT driver?
A. García, D. S. Kolovos Models from Code or Code as a Model? 8 / 13
Intro Proposal Evaluation Conclusion
Experiment setup
Inputs
Source code: JFreeChart 1.0.17, 1.0.18 and 1.0.19
UML model for 1.0.17 extracted by Modelio
Tools
MoDisco 0.13.2 discoverer extracted 1 .xmi per version
Epsilon interim (3d4408), emc-jdt interim (5b5ea)
Validation task: implemented in the Epsilon Validation Language
1 version for MoDisco, 2 for EMC JDT (select/search)
Rules:
1 Each UML class has its corresponding Java class
2 Each UML method is implemented in that Java class
3 Each nested class obeys the two above rules
4 validation errors found in 1.0.18 and 1.0.19
A. García, D. S. Kolovos Models from Code or Code as a Model? 9 / 13
Intro Proposal Evaluation Conclusion
Performance results
MoDisco validates all versions in 112.2s, JDT/select in 71.92s, JDT/search in 36.52s
1.0.17
1.0.18
1.0.19
1.0.17
1.0.18
1.0.19
1.0.17
1.0.18
1.0.19
0
10
20
30
40
JDT w/select JDT w/searchMoDisco
Executiontime(s)
Extract Load Validation
A. García, D. S. Kolovos Models from Code or Code as a Model? 10 / 13
Intro Proposal Evaluation Conclusion
Performance discussion
MoDisco: slower loading for faster validation
When using .xmi files, we load entire model into memory
Pro: with everything in memory, validation is faster
Con: huge models won’t fit in memory
We’ll need a store with on-demand loading (e.g. CDO)
On-demand loading can change performance profile
Amortisation of extraction costs depends on codebase
Frozen codebase (e.g. legacy systems):
Full extraction is quickly amortised
MoDisco is a better choice
Quickly changing codebase (e.g. actively developed systems):
Extracting on demand is usually better (models don’t live long)
EMC JDT is a better choice
A. García, D. S. Kolovos Models from Code or Code as a Model? 11 / 13
Intro Proposal Evaluation Conclusion
Conclusion and future lines of work
Summary
Codebases are a valuable input for many SE tasks
Two options to query codebases:
Extract standalone models (MoDisco)
Use code directly as a model (EMC JDT)
EMC JDT is faster for changing codebases
Future work
Further optimisations to improve performance
Evaluate impact of future JDT versions
More filtering fields for searchable collections
More shorthand properties for common scenarios
Port approach to other languages (e.g. C++ through CDT)
A. García, D. S. Kolovos Models from Code or Code as a Model? 12 / 13
End of the presentation
Questions?
@antoniogado
A. García, D. S. Kolovos Models from Code or Code as a Model? 13 / 13
Extra features in EMC JDT
Shorthand properties
Quick access to commonly needed information
EMC PropertyGetter computes value on demand
FieldDeclaration: “name”
BodyDeclaration: “public”, “static”...
A. García, D. S. Kolovos Models from Code or Code as a Model? 14 / 13

Más contenido relacionado

La actualidad más candente

Introduction to Programming
Introduction to ProgrammingIntroduction to Programming
Introduction to Programming
ALI RAZA
 
Introduction to llvm
Introduction to llvmIntroduction to llvm
Introduction to llvm
Tao He
 
Language Engineering in the Cloud
Language Engineering in the CloudLanguage Engineering in the Cloud
Language Engineering in the Cloud
lennartkats
 
OpenOffice++: Improving the Quality of Open Source Software
OpenOffice++: Improving the Quality of Open Source SoftwareOpenOffice++: Improving the Quality of Open Source Software
OpenOffice++: Improving the Quality of Open Source Software
Alexandro Colorado
 

La actualidad más candente (15)

ctchou-resume
ctchou-resumectchou-resume
ctchou-resume
 
Cd2Alloy
Cd2AlloyCd2Alloy
Cd2Alloy
 
Introduction to Programming
Introduction to ProgrammingIntroduction to Programming
Introduction to Programming
 
Introduction to llvm
Introduction to llvmIntroduction to llvm
Introduction to llvm
 
Oleksii Moskalenko "Continuous Delivery of ML Pipelines to Production"
Oleksii Moskalenko "Continuous Delivery of ML Pipelines to Production"Oleksii Moskalenko "Continuous Delivery of ML Pipelines to Production"
Oleksii Moskalenko "Continuous Delivery of ML Pipelines to Production"
 
Benefits of Extensions
Benefits of ExtensionsBenefits of Extensions
Benefits of Extensions
 
Paradigms
ParadigmsParadigms
Paradigms
 
Prgramming paradigms
Prgramming paradigmsPrgramming paradigms
Prgramming paradigms
 
CS152 Programming Paradigm
CS152 Programming Paradigm CS152 Programming Paradigm
CS152 Programming Paradigm
 
Language Engineering in the Cloud
Language Engineering in the CloudLanguage Engineering in the Cloud
Language Engineering in the Cloud
 
OpenOffice++: Improving the Quality of Open Source Software
OpenOffice++: Improving the Quality of Open Source SoftwareOpenOffice++: Improving the Quality of Open Source Software
OpenOffice++: Improving the Quality of Open Source Software
 
S6 cad5
S6 cad5S6 cad5
S6 cad5
 
Programming Methodology
Programming MethodologyProgramming Methodology
Programming Methodology
 
Programming Paradigm & Languages
Programming Paradigm & LanguagesProgramming Paradigm & Languages
Programming Paradigm & Languages
 
UnDeveloper Studio
UnDeveloper StudioUnDeveloper Studio
UnDeveloper Studio
 

Similar a OCL'16 slides: Models from Code or Code as a Model?

Discover models out of existing applications with Eclipse/MoDisco
Discover models out of existing applications with Eclipse/MoDiscoDiscover models out of existing applications with Eclipse/MoDisco
Discover models out of existing applications with Eclipse/MoDisco
fmadiot
 
MoDisco Poster EclipseCon 2009
MoDisco Poster EclipseCon 2009MoDisco Poster EclipseCon 2009
MoDisco Poster EclipseCon 2009
fmadiot
 
Lecture 1 uml with java implementation
Lecture 1 uml with java implementationLecture 1 uml with java implementation
Lecture 1 uml with java implementation
the_wumberlog
 
Track A-Compilation guiding and adjusting - IBM
Track A-Compilation guiding and adjusting - IBMTrack A-Compilation guiding and adjusting - IBM
Track A-Compilation guiding and adjusting - IBM
chiportal
 

Similar a OCL'16 slides: Models from Code or Code as a Model? (20)

Discover models out of existing applications with Eclipse/MoDisco
Discover models out of existing applications with Eclipse/MoDiscoDiscover models out of existing applications with Eclipse/MoDisco
Discover models out of existing applications with Eclipse/MoDisco
 
MoDisco Poster EclipseCon 2009
MoDisco Poster EclipseCon 2009MoDisco Poster EclipseCon 2009
MoDisco Poster EclipseCon 2009
 
C++Basics2022.pptx
C++Basics2022.pptxC++Basics2022.pptx
C++Basics2022.pptx
 
Eclipse World 2007: Fundamentals of the Eclipse Modeling Framework
Eclipse World 2007: Fundamentals of the Eclipse Modeling FrameworkEclipse World 2007: Fundamentals of the Eclipse Modeling Framework
Eclipse World 2007: Fundamentals of the Eclipse Modeling Framework
 
ECMFA 2016 slides
ECMFA 2016 slidesECMFA 2016 slides
ECMFA 2016 slides
 
ALT
ALTALT
ALT
 
MSalah_20161010
MSalah_20161010MSalah_20161010
MSalah_20161010
 
Symbolic Execution And KLEE
Symbolic Execution And KLEESymbolic Execution And KLEE
Symbolic Execution And KLEE
 
Framework engineering JCO 2011
Framework engineering JCO 2011Framework engineering JCO 2011
Framework engineering JCO 2011
 
Re-implementing Thrift using MDE
Re-implementing Thrift using MDERe-implementing Thrift using MDE
Re-implementing Thrift using MDE
 
Object Oriented Concepts and Principles
Object Oriented Concepts and PrinciplesObject Oriented Concepts and Principles
Object Oriented Concepts and Principles
 
(1) c sharp introduction_basics_dot_net
(1) c sharp introduction_basics_dot_net(1) c sharp introduction_basics_dot_net
(1) c sharp introduction_basics_dot_net
 
JavaScript Miller Columns
JavaScript Miller ColumnsJavaScript Miller Columns
JavaScript Miller Columns
 
Whats New in Visual Studio 2012 for C++ Developers
Whats New in Visual Studio 2012 for C++ DevelopersWhats New in Visual Studio 2012 for C++ Developers
Whats New in Visual Studio 2012 for C++ Developers
 
Tools and Methods for Continuously Expanding Software Applications
Tools and Methods for Continuously Expanding Software ApplicationsTools and Methods for Continuously Expanding Software Applications
Tools and Methods for Continuously Expanding Software Applications
 
Lecture 1 uml with java implementation
Lecture 1 uml with java implementationLecture 1 uml with java implementation
Lecture 1 uml with java implementation
 
MDE=Model Driven Everything (Spanish Eclipse Day 2009)
MDE=Model Driven Everything (Spanish Eclipse Day 2009)MDE=Model Driven Everything (Spanish Eclipse Day 2009)
MDE=Model Driven Everything (Spanish Eclipse Day 2009)
 
Track A-Compilation guiding and adjusting - IBM
Track A-Compilation guiding and adjusting - IBMTrack A-Compilation guiding and adjusting - IBM
Track A-Compilation guiding and adjusting - IBM
 
MODEL DRIVEN ARCHITECTURE, CONTROL SYSTEMS AND ECLIPSE
MODEL DRIVEN ARCHITECTURE, CONTROL SYSTEMS AND ECLIPSEMODEL DRIVEN ARCHITECTURE, CONTROL SYSTEMS AND ECLIPSE
MODEL DRIVEN ARCHITECTURE, CONTROL SYSTEMS AND ECLIPSE
 
Introduction-to-C-Part-1.pdf
Introduction-to-C-Part-1.pdfIntroduction-to-C-Part-1.pdf
Introduction-to-C-Part-1.pdf
 

Más de Antonio García-Domínguez

Software libre para la integración de información en la Universidad de Cádiz
Software libre para la integración de información en la Universidad de CádizSoftware libre para la integración de información en la Universidad de Cádiz
Software libre para la integración de información en la Universidad de Cádiz
Antonio García-Domínguez
 

Más de Antonio García-Domínguez (16)

MODELS 2022 Journal-First presentation: ETeMoX - explaining reinforcement lea...
MODELS 2022 Journal-First presentation: ETeMoX - explaining reinforcement lea...MODELS 2022 Journal-First presentation: ETeMoX - explaining reinforcement lea...
MODELS 2022 Journal-First presentation: ETeMoX - explaining reinforcement lea...
 
MODELS 2022 Picto Web tool demo
MODELS 2022 Picto Web tool demoMODELS 2022 Picto Web tool demo
MODELS 2022 Picto Web tool demo
 
EduSymp 2022 slides (The Epsilon Playground)
EduSymp 2022 slides (The Epsilon Playground)EduSymp 2022 slides (The Epsilon Playground)
EduSymp 2022 slides (The Epsilon Playground)
 
History-Aware Explanations: Towards Enabling Human-in-the-Loop in Self-Adapti...
History-Aware Explanations: Towards Enabling Human-in-the-Loop in Self-Adapti...History-Aware Explanations: Towards Enabling Human-in-the-Loop in Self-Adapti...
History-Aware Explanations: Towards Enabling Human-in-the-Loop in Self-Adapti...
 
Boosting individual feedback with AutoFeedback
Boosting individual feedback with AutoFeedbackBoosting individual feedback with AutoFeedback
Boosting individual feedback with AutoFeedback
 
MODELS 2019: Querying and annotating model histories with time-aware patterns
MODELS 2019: Querying and annotating model histories with time-aware patternsMODELS 2019: Querying and annotating model histories with time-aware patterns
MODELS 2019: Querying and annotating model histories with time-aware patterns
 
Tips and resources for publication-grade figures and tables
Tips and resources for publication-grade figures and tablesTips and resources for publication-grade figures and tables
Tips and resources for publication-grade figures and tables
 
COMMitMDE'18: Eclipse Hawk: model repository querying as a service
COMMitMDE'18: Eclipse Hawk: model repository querying as a serviceCOMMitMDE'18: Eclipse Hawk: model repository querying as a service
COMMitMDE'18: Eclipse Hawk: model repository querying as a service
 
MRT 2018: reflecting on the past and the present with temporal graph models
MRT 2018: reflecting on the past and the present with temporal graph modelsMRT 2018: reflecting on the past and the present with temporal graph models
MRT 2018: reflecting on the past and the present with temporal graph models
 
Hawk: indexado de modelos en bases de datos NoSQL
Hawk: indexado de modelos en bases de datos NoSQLHawk: indexado de modelos en bases de datos NoSQL
Hawk: indexado de modelos en bases de datos NoSQL
 
Software and product quality for videogames
Software and product quality for videogamesSoftware and product quality for videogames
Software and product quality for videogames
 
Developing a new Epsilon Language through Annotations: TestLang
Developing a new Epsilon Language through Annotations: TestLangDeveloping a new Epsilon Language through Annotations: TestLang
Developing a new Epsilon Language through Annotations: TestLang
 
MoDELS'16 presentation: Integration of a Graph-Based Model Indexer in Commerc...
MoDELS'16 presentation: Integration of a Graph-Based Model Indexer in Commerc...MoDELS'16 presentation: Integration of a Graph-Based Model Indexer in Commerc...
MoDELS'16 presentation: Integration of a Graph-Based Model Indexer in Commerc...
 
BMSD 2015 slides (revised)
BMSD 2015 slides (revised)BMSD 2015 slides (revised)
BMSD 2015 slides (revised)
 
Elaboración de un buen póster científico
Elaboración de un buen póster científicoElaboración de un buen póster científico
Elaboración de un buen póster científico
 
Software libre para la integración de información en la Universidad de Cádiz
Software libre para la integración de información en la Universidad de CádizSoftware libre para la integración de información en la Universidad de Cádiz
Software libre para la integración de información en la Universidad de Cádiz
 

Último

CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 

Último (20)

CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 

OCL'16 slides: Models from Code or Code as a Model?

  • 1. Intro Proposal Evaluation Conclusion Models from Code or Code as a Model? Antonio García-Domínguez, Dimitris Kolovos Aston University, University of York OCL’16 October 2nd, 2016 A. García, D. S. Kolovos Models from Code or Code as a Model? 1 / 13
  • 2. Intro Proposal Evaluation Conclusion Using codebases to drive software engineering tasks Usual sequence of events We had a business need We invested in developing a program that covered it Now we may need to: Extract architecture or underlying business process? Find bugs before they hit us? Improve its design? Migrate it to a new technology? Code is the most accurate description: let’s use it How do we extract knowledge? Regexps do not scale to complex tasks We need something that understands the language The “extractor” is embedded within a process A. García, D. S. Kolovos Models from Code or Code as a Model? 2 / 13
  • 3. Intro Proposal Evaluation Conclusion Existing approaches Some well-known reverse engineering tools (“extractors”) Eclipse MoDisco: EMF-based, implements KDM/ASTM JaMoPP: EMF-based, uses custom metamodel Moose: FAMIX-based tool Rascal: extracts partial JDT representation into a model Issue: extractors are one-off processes They produce standalone models: the code is no longer needed However, current tools are not incremental: if the code is changed, the extraction has to be redone from scratch Issue: extractors are not query-aware Some tasks will only access a small part of the codebase Extracting the rest only adds overhead A. García, D. S. Kolovos Models from Code or Code as a Model? 3 / 13
  • 4. Intro Proposal Evaluation Conclusion Epsilon EMC JDT driver: use IDE indices as models IDEs already extract representations all the time Eclipse indexes Java projects on the background Keeps fast pointers to classes / methods Extra info available on demand through parsing JDT indices are under active improvement: See Stefan Xenos’ talk on EclipseCon NA’16 Cross-pollination from CDT project (C++) Faster, more thorough indexing coming in future releases Our proposal: Epsilon EMC JDT driver Expose code as seen by IDE (JDT) as a model On-demand loading + direct access to Java classes Sources available on GitHub (epsilonlabs/emc-jdt) A. García, D. S. Kolovos Models from Code or Code as a Model? 4 / 13
  • 5. Intro Proposal Evaluation Conclusion Making it possible: Epsilon architecture Epsilon Object Language (EOL) = JavaScript + OCL Epsilon Model Connectivity (EMC) Core Model Validation (EVL) Code Generation (EGL) Model-to-model Transformation (ETL) ... Task-specific languages Technology-specific drivers Eclipse Modeling Framework (EMF) Schema-less XML Eclipse Java Developer Tools (JDT) CSV ... extends implements All Epsilon languages are based on EOL EOL accesses models through EMC interfaces By implementing the EMC interfaces, all Epsilon languages can use JDT indices as models A. García, D. S. Kolovos Models from Code or Code as a Model? 5 / 13
  • 6. Intro Proposal Evaluation Conclusion Configuration dialog for an EMC JDT model A. García, D. S. Kolovos Models from Code or Code as a Model? 6 / 13
  • 7. Intro Proposal Evaluation Conclusion allInstances() in EMC JDT Reflection-based X.allInstances 1 Parse Java sources in the projects on the fly 2 Traverse JDT Document Object Model with ASTVisitor 3 Use Java reflection to fetch instances of X 4 Cache for later executions, if desired Special case: TypeDeclaration.allInstances Searchable, lazy (no parsing unless looping over it) Supports two new operations: c.select(it|it.name = expr) searches with JDT the relevant compilation unit, parses it and returns the right DOM node c.search(it|it.name = expr) works the same, but it returns the raw index entry (a simpler JDT SourceType) A. García, D. S. Kolovos Models from Code or Code as a Model? 7 / 13
  • 8. Intro Proposal Evaluation Conclusion Case study: validate code against UML models Overview We are maintaining a library, and we need to check its compliance with a UML model as it changes Here, “compliance” means “must have all the classes and methods in the UML model” (code may have more) Which is faster/more convenient: extracting a model with MoDisco first, or checking it directly with the EMC JDT driver? A. García, D. S. Kolovos Models from Code or Code as a Model? 8 / 13
  • 9. Intro Proposal Evaluation Conclusion Experiment setup Inputs Source code: JFreeChart 1.0.17, 1.0.18 and 1.0.19 UML model for 1.0.17 extracted by Modelio Tools MoDisco 0.13.2 discoverer extracted 1 .xmi per version Epsilon interim (3d4408), emc-jdt interim (5b5ea) Validation task: implemented in the Epsilon Validation Language 1 version for MoDisco, 2 for EMC JDT (select/search) Rules: 1 Each UML class has its corresponding Java class 2 Each UML method is implemented in that Java class 3 Each nested class obeys the two above rules 4 validation errors found in 1.0.18 and 1.0.19 A. García, D. S. Kolovos Models from Code or Code as a Model? 9 / 13
  • 10. Intro Proposal Evaluation Conclusion Performance results MoDisco validates all versions in 112.2s, JDT/select in 71.92s, JDT/search in 36.52s 1.0.17 1.0.18 1.0.19 1.0.17 1.0.18 1.0.19 1.0.17 1.0.18 1.0.19 0 10 20 30 40 JDT w/select JDT w/searchMoDisco Executiontime(s) Extract Load Validation A. García, D. S. Kolovos Models from Code or Code as a Model? 10 / 13
  • 11. Intro Proposal Evaluation Conclusion Performance discussion MoDisco: slower loading for faster validation When using .xmi files, we load entire model into memory Pro: with everything in memory, validation is faster Con: huge models won’t fit in memory We’ll need a store with on-demand loading (e.g. CDO) On-demand loading can change performance profile Amortisation of extraction costs depends on codebase Frozen codebase (e.g. legacy systems): Full extraction is quickly amortised MoDisco is a better choice Quickly changing codebase (e.g. actively developed systems): Extracting on demand is usually better (models don’t live long) EMC JDT is a better choice A. García, D. S. Kolovos Models from Code or Code as a Model? 11 / 13
  • 12. Intro Proposal Evaluation Conclusion Conclusion and future lines of work Summary Codebases are a valuable input for many SE tasks Two options to query codebases: Extract standalone models (MoDisco) Use code directly as a model (EMC JDT) EMC JDT is faster for changing codebases Future work Further optimisations to improve performance Evaluate impact of future JDT versions More filtering fields for searchable collections More shorthand properties for common scenarios Port approach to other languages (e.g. C++ through CDT) A. García, D. S. Kolovos Models from Code or Code as a Model? 12 / 13
  • 13. End of the presentation Questions? @antoniogado A. García, D. S. Kolovos Models from Code or Code as a Model? 13 / 13
  • 14. Extra features in EMC JDT Shorthand properties Quick access to commonly needed information EMC PropertyGetter computes value on demand FieldDeclaration: “name” BodyDeclaration: “public”, “static”... A. García, D. S. Kolovos Models from Code or Code as a Model? 14 / 13