56
Quantitative Analysis of Model Transformations Phu H. Nguyen ([email protected]) Supervisor: Prof. Dr. Mark van den Brand Tutor: Ir. Marcel van Amstel

Quantitative Analysis of Model Transformations

Embed Size (px)

DESCRIPTION

Quantitative Analysis of Model Transformations. Phu H. Nguyen ([email protected]) Supervisor: Prof. Dr. Mark van den Brand Tutor: Ir. Marcel van Amstel. Agenda. Introduction Project goal Xtend Model Transformations Metrics for Xtend Xtend Extractor Tools A case study - PowerPoint PPT Presentation

Citation preview

Page 1: Quantitative Analysis of Model Transformations

Quantitative Analysis ofModel Transformations

Phu H. Nguyen ([email protected])

Supervisor: Prof. Dr. Mark van den Brand

Tutor: Ir. Marcel van Amstel

Page 2: Quantitative Analysis of Model Transformations

Agenda

• Introduction• Project goal• Xtend Model Transformations

• Metrics for Xtend • Xtend Extractor Tools• A case study

• QVTo Model Transformations• Metrics for QVTo• QVTo Extractor Tools• A case study

• Conclusions

/ Department of Mathematics and Computer Science PAGE 219-04-2023

Page 3: Quantitative Analysis of Model Transformations

Introduction

• Model Driven Software Development (MDSD):• High level design models at the heart of the development

process• Software development automation• Benefits : Productivity, agility, reliability

• MDE world:• Domain-specific languages (DSL)• Model-to-model transformations (M2M)• Model-to-text transformations (M2T)

/ Department of Mathematics and Computer Science PAGE 319-04-2023

Page 4: Quantitative Analysis of Model Transformations

/ Department of Mathematics and Computer Science PAGE 419-04-2023

How MDSD works

Page 5: Quantitative Analysis of Model Transformations

Model-to-model transformations

• ATL - the Atlas Transformation Language• QVT (Operational) - An implementation of OMG’s spec.• Xtend - openArchitechtureWare (oAW) ’s transformation

language (also used for other tasks within oAW)• Epsilon, Kermeta, Stratego, etc.

/ Department of Mathematics and Computer Science PAGE 519-04-2023

Page 6: Quantitative Analysis of Model Transformations

Model transformations

• The heart and soul of MDSD• A methodology for developing model transformations

with high quality?• Approach: assessing the internal quality of model

transformations• Quality assessment of model transformations:

• ASF+SDF: enabled• ATL: enabled• QVT: ?• Xtend: ?• Epsilon , Kermeta, Stratego: ?

/ Department of Mathematics and Computer Science PAGE 619-04-2023

Page 7: Quantitative Analysis of Model Transformations

Project goal

• Enable quality assessment for model transformations by means of metrics.

• Enable coverage analysis.• Enable dependency analysis.• Focus on Xtend, QVT-Operational.

/ Department of Mathematics and Computer Science PAGE 719-04-2023

Page 8: Quantitative Analysis of Model Transformations

Sub-goals

• A metrics suite for measuring Xtend model transformations.

• A metrics suite for measuring QVTo model transformations.

• Tools that enables automatic extraction of Xtend metrics, coverage and dependency data.

• Similar tools for QVTo.• Perform case studies to validate the results.

/ Department of Mathematics and Computer Science PAGE 819-04-2023

Page 9: Quantitative Analysis of Model Transformations

oAW & Xtend model transformations

• openArchitectureWare (oAW)• An integrated, one-stop toolkit for MDSD

− model-to-model transformations (Xtend)− model-to-text-transformations (Xpand)− text-to-model (Xtext)

• Migration to Eclipse:• Xpand, Xtend and Check → Model-to-Text Transformation• Xtext → Textual Modeling Framework• oAW workflow engine → Modeling Workflow Engine (MWE)

/ Department of Mathematics and Computer Science PAGE 919-04-2023

Page 10: Quantitative Analysis of Model Transformations

/ Department of Mathematics and Computer Science PAGE 1019-04-2023

An overview of oAW

Page 11: Quantitative Analysis of Model Transformations

Xtend

• The transformation language used throughout oAW:• Constraint checks• Model transformations• Generators

PAGE 1119-04-2023

Page 12: Quantitative Analysis of Model Transformations

Xtend model transformations…

… are defined in extension files (*.ext):• Import statements

• Import name spaces (meta-models)• Import (reexport) built-in libraries or another extend files

• Extensions (transformation functions)

/ Department of Mathematics and Computer Science PAGE 1219-04-2023

Page 13: Quantitative Analysis of Model Transformations

• Rules to transform a Book model to a Publication model:• Each Book instance → a Publication instance• The title of a Book → the title of a Publication • The total number of pages of a Publication is the sum of the

pages of the Chapters of a Book.

/ Department of Mathematics and Computer Science PAGE 1319-04-2023

Book → Publication

Page 14: Quantitative Analysis of Model Transformations

Book → Publication: Extension File

/ Department of Mathematics and Computer Science PAGE 1419-04-2023

Page 15: Quantitative Analysis of Model Transformations

Quality Attributes

• Understandability• Modifiability• Reusability• Modularity• Completeness• Consistency• Conciseness• Performance

/ Department of Mathematics and Computer Science PAGE 1519-04-2023

Page 16: Quantitative Analysis of Model Transformations

Metrics for Xtend model transformations

• Categories:• Extension metrics• Dependency metrics• Miscellaneous metrics

• Two types of metric:• Simple metric: single value• Aggregate metric: min, max, avg, med, std dev

• Total 97 metrics

/ Department of Mathematics and Computer Science PAGE 1619-04-2023

Page 17: Quantitative Analysis of Model Transformations

Some examples of Xtend metrics

/ Department of Mathematics and Computer Science PAGE 1719-04-2023

Simple Metric Aggregate Metric Quality Attribute

# Overloaded Extensions# Local Variables

# Arounds per Xtend file Understandability

# Extensions per Extension Name,# Collection expressions

Extension Cyclomatic Complexity,# Usages per Extension, # Calls from outside to local Extensions per Xtend file (fan-in)

Modifiability

# Xtend files# Private Extensions

# Usages per Xtend file, # Usages per Extension (fan-in)

Reusability

# Xtend files # Extension Calls per Extension (fan-out) Modularity

# Calls to IO Extensions # null Extensions per Xtend file Completeness

# Variables with same name but different types

# Unused local Variables Consistency

# Unused Local Variables, # Unused Extensions

# Unused Parameters perExtension

Conciseness

# Cached Extensions # Cached Extensions per Xtend file Performance

Page 18: Quantitative Analysis of Model Transformations

Tools

• Design requirements• Input: Extension files• Output: Metrics, Coverage and Dependency data• Extensibility:

− New metrics can be defined easily− The calculation of a new metric can be implemented

quickly.

PAGE 1819-04-2023

Page 19: Quantitative Analysis of Model Transformations

Xtend - data models

PAGE 1919-04-2023

Page 20: Quantitative Analysis of Model Transformations

Xtend Extractor Tools

• Java-based Xtend Extractor Tool (JXET)− Elements of the Xtend AST → data model (in-memory

Java Objects)− Implemented in Java

• XML-based Xtend Extractor Tool (XXET)− Elements of the Xtend AST → XML file− Using Xpath, Xquery

PAGE 2019-04-2023

Page 21: Quantitative Analysis of Model Transformations

Architecture of JXET

• Data model = Java Objects

PAGE 2119-04-2023

Page 22: Quantitative Analysis of Model Transformations

JXET: Metrics Extractor

PAGE 2219-04-2023

Page 23: Quantitative Analysis of Model Transformations

Example – Sync2Async

/ Department of Mathematics and Computer Science PAGE 23

Page 24: Quantitative Analysis of Model Transformations

Sync2Async - Simple Metrics

PAGE 2419-04-2023

Page 25: Quantitative Analysis of Model Transformations

Sync2Async - Aggregate Metrics (1)

PAGE 2519-04-2023

Page 26: Quantitative Analysis of Model Transformations

/ Department of Mathematics and Computer Science PAGE 26

Sync2Async - Aggregate Metrics (2)

19-04-2023

Page 27: Quantitative Analysis of Model Transformations

Dependencies extractor

PAGE 2719-04-2023

Page 28: Quantitative Analysis of Model Transformations

Sync2Async– Dependencies Graph

/ Department of Mathematics and Computer Science PAGE 2819-04-2023

Page 29: Quantitative Analysis of Model Transformations

Architecture of XXET

/ Department of Mathematics and Computer Science PAGE 2919-04-2023

Page 30: Quantitative Analysis of Model Transformations

XXET

/ Department of Mathematics and Computer Science PAGE 3019-04-2023

Page 31: Quantitative Analysis of Model Transformations

/ Department of Mathematics and Computer Science PAGE 3119-04-2023

XXET

Page 32: Quantitative Analysis of Model Transformations

/ Department of Mathematics and Computer Science PAGE 3219-04-2023

XXET

Page 33: Quantitative Analysis of Model Transformations

/ Department of Mathematics and Computer Science PAGE 3319-04-2023

XXET

Page 34: Quantitative Analysis of Model Transformations

Query, View, Transformation (QVT)

• The declarative parts:• Relations• Core

• Imperative implementations:• Operational Mappings• Black-box MOF Operation

/ Department of Mathematics and Computer Science PAGE 3419-04-2023

Page 35: Quantitative Analysis of Model Transformations

QVT Implementations

• QVT-Operational (QVTo)• SmartQVT• Eclipse M2M Operational QVT

(QVTo is the best supported variant in terms of tools)

/ Department of Mathematics and Computer Science PAGE 3519-04-2023

Page 36: Quantitative Analysis of Model Transformations

QVTo structure

• Transformation declaration• Imperative operations (mappings, helpers, queries,

constructors)• Intermediate data• Object creation and update mechanism• Trace resolution expressions• ImperativeOCL - extension to OCL expressions and type

system• Standard Library

/ Department of Mathematics and Computer Science PAGE 3619-04-2023

Page 37: Quantitative Analysis of Model Transformations

Book → Publication: QVTo

/ Department of Mathematics and Computer Science PAGE 3719-04-2023

Page 38: Quantitative Analysis of Model Transformations

Metrics for QVTo model transformations

• Categories:• Mapping metrics• Helper /Query metrics• Dependency metrics• Miscellaneous metrics

• Two types of metric:• Simple metric: value• Aggregate metric: min, max, avg, med, std dev

• Total 98 metrics

/ Department of Mathematics and Computer Science PAGE 3819-04-2023

Page 39: Quantitative Analysis of Model Transformations

Some examples of QVTo metrics

/ Department of Mathematics and Computer Science PAGE 3919-04-2023

Simple Metric Aggregate Metric Quality Attribute

# Mappings with Condition Cyclomatic Complexity per Mapping,# Intermediate Classes per Module

Understandability

# Mapping Inheritances,# Intermediate Properties

Cyclomatic Complexity per Helper,# Calls to other Modules per Module (fan-out)# Operations on Collections per Mapping

Modifiability

# Modules # Times a Module is imported per Module (fan-in), # Calls from other Modules per Module

Reusability

# Modules # Mappings per Module Modularity

# Calls to log(), assert() # Unused Variables per Mapping Completeness

# Variables with same name but different types

# Intermediate Properties per Module Consistency

# Unused Mappings # Unused Parameters per Mapping Conciseness

Page 40: Quantitative Analysis of Model Transformations

QVTo – Data models

/ Department of Mathematics and Computer Science PAGE 4019-04-2023

Page 41: Quantitative Analysis of Model Transformations

PAGE 4119-04-2023

Model-based QVTo Extractor Tool (MQET)

Page 42: Quantitative Analysis of Model Transformations

PAGE 4219-04-2023

Metrics M2M Extractor (QVTo)

Page 43: Quantitative Analysis of Model Transformations

QVTo2Metrics Extractor

/ Department of Mathematics and Computer Science PAGE 4319-04-2023

Page 44: Quantitative Analysis of Model Transformations

/ Department of Mathematics and Computer Science PAGE 4419-04-2023

QVTo2Metrics.qvto

Page 45: Quantitative Analysis of Model Transformations

/ Department of Mathematics and Computer Science PAGE 4519-04-2023

QVTo2Metrics.metrics

Page 46: Quantitative Analysis of Model Transformations

PAGE 4619-04-2023

Metrics M2T Extractor (Xpand)

Page 47: Quantitative Analysis of Model Transformations

/ Department of Mathematics and Computer Science PAGE 4719-04-2023

Single metrics extracted

Page 48: Quantitative Analysis of Model Transformations

/ Department of Mathematics and Computer Science PAGE 4819-04-2023

Aggregate metrics extracted (1)

Page 49: Quantitative Analysis of Model Transformations

/ Department of Mathematics and Computer Science PAGE 4919-04-2023

Aggregate metrics extracted (2)

Page 50: Quantitative Analysis of Model Transformations

/ Department of Mathematics and Computer Science PAGE 5019-04-2023

Coverage Extractor

Page 51: Quantitative Analysis of Model Transformations

/ Department of Mathematics and Computer Science PAGE 5119-04-2023

Coverage Graph

Page 52: Quantitative Analysis of Model Transformations

Conclusions (1)

• 1 - A set of 97 metrics for measuring Xtend model transformations.

• 2 - A set of 98 metrics for measuring QVTo model transformations.

• Many metrics for different transformations (ATL, Xtend, QVTo) are conceptually equivalent.

• Still some metrics are entirely specific.

/ Department of Mathematics and Computer Science PAGE 5219-04-2023

Page 53: Quantitative Analysis of Model Transformations

Conclusions (2)

• 3 ways to develop a tool for automated extraction of metrics, coverage and dependency data.

• 3 sets of tools (JXET, XXET, MQET) have been developed.

• A methodology for developing tools for measuring model transformations defined in different languages.

• Implementation of such a tool is specific for different languages.

/ Department of Mathematics and Computer Science PAGE 5319-04-2023

Page 54: Quantitative Analysis of Model Transformations

/ Department of Mathematics and Computer Science PAGE 5419-04-2023

A methodology for developing tools

Page 55: Quantitative Analysis of Model Transformations

Future work

• Some missing implementations are deferred for future work.

• Empirical studies.• A methodology for improving quality of model

transformations• Set of guidelines

/ Department of Mathematics and Computer Science PAGE 5519-04-2023

Page 56: Quantitative Analysis of Model Transformations

The end.

/ Department of Mathematics and Computer Science PAGE 5619-04-2023

“Anything will give up its secrets if you love it enough” -- George Washington

“If you have to kiss a lot of frogs to find a prince, find more frogs and kiss them faster and faster” -- Ron Kohavi