1 / 42

Quality Assessment of Xtend Model Transformations

Quality Assessment of Xtend Model Transformations. Phu H. Nguyen, h.p.nguyen@student.tue.nl Supervisor: Prof. dr. Mark van den Brand Tutor: Ir. Marcel van Amstel. Agenda. Introduction Project goal Overview of Xtend model transformations Metrics

hasad-bryan
Télécharger la présentation

Quality Assessment of Xtend Model Transformations

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Quality Assessment ofXtend Model Transformations Phu H. Nguyen, h.p.nguyen@student.tue.nl Supervisor: Prof. dr. Mark van den Brand Tutor: Ir. Marcel van Amstel

  2. Agenda Introduction Project goal Overview of Xtend model transformations Metrics How to extract data from Xtend model transformations Tools Case studies Conclusions / Department of Mathematics and Computer Science

  3. Introduction • Model Driven Software Development (MDSD): the next level of software development • High level design models at the heart of the development process • Software development automation • Benefits : Productivity, agility, reliability • MDSD world: • Domain-specific languages (DSL) • Model transformations M2M (Model-to-Model) • Model transformations M2T (Model-to-Text) / Department of Mathematics and Computer Science 1-9-2010 PAGE 2

  4. How MDSD works

  5. M2M : Transform models to models 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) / Department of Mathematics and Computer Science 1-9-2010 PAGE 4

  6. Model transformations M2M • Is there a methodology for developing model transformations with high quality? • Need of assessing the quality of model transformations • Quality assessment of model transformations: • ASF+SDF: enabled • ATL: enabled • QVT: ? • Xtend: ? / Department of Mathematics and Computer Science 1-9-2010 PAGE 5

  7. Project goal The main goal is to enable quality assessment for Xtend model transformations by means of metrics. Approach: assessing the internal quality of model transformations by extracting metrics from the model transformations directly. / Department of Mathematics and Computer Science 1-9-2010 PAGE 6

  8. Sub-goals • Four sub-goals: • Discover the details behind Xtend model transformations. • Establish a metrics suite enables quality measurement of Xtend model transformations. • Develop a tool that enables automatic calculation of those metrics. • Perform case studies to validate the results. / Department of Mathematics and Computer Science 1-9-2010 PAGE 7

  9. oAW & Xtend model transformations An integrated, tested, one-stop toolkit for MDSD oAW essentially makes it possible to process code generators for any type of model. Any type of source code can be generated from the model sources. / Department of Mathematics and Computer Science

  10. Features of oAW • The most important features of oAW include: • support of various modeling tools • support of EMF (Eclipse Modeling Framework) • model-to-model transformations • model-to-code-transformations • eclipse integration • Migrated to Eclipse: • http://www.eclipse.org/workinggroups/oaw/ • Xpand/Xtend/Check / Department of Mathematics and Computer Science 1-9-2010 PAGE 9

  11. oAW components Metamodel definition: EMF, UML model Graphical model editor: Eclipse GMF Textual model editor: Xtext Model transformation: Xtend Model validation: Check Code generation: Xpand Metamodel extension: Xtext / Department of Mathematics and Computer Science 1-9-2010 PAGE 10

  12. Xtend model transformations in oAW

  13. Xtend • OCL-like expression language used throughout oAW • Can be used in constraint checks, model transformations and generators • Add “methods” to meta types (Java calls are possible if necessary) • path expressions, set operations, (some) higher order functions • Polymorphism (multiple dispatch) • Tool support(syntax highlighting, code completion, debugger)

  14. 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 • Create extensions • Expression extensions • Java extensions / Department of Mathematics and Computer Science 1-9-2010 PAGE 13

  15. Xtend model transformations Xtend has some special support for M2M transformations • Create-Extensions are used to create a new instance • A new element is created only once for the same set of parameters • Cached Extension can be used for perfomence improvements • The same value is returned each time the extension is called with the same set of parameters • Several utility extensions (built-in libraries) for naming, tracing, debugging, cloning, … / Department of Mathematics and Computer Science 1-9-2010 PAGE 14

  16. Book → Publication • 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 1-9-2010 PAGE 15

  17. Book → Publication / Department of Mathematics and Computer Science 1-9-2010 PAGE 16

  18. Book → Publication: Extension File / Department of Mathematics and Computer Science 1-9-2010 PAGE 17

  19. Metrics for Xtend model transformations • A set of metrics has been proposed for enabling quality assessment of Xtend model transformations • These metrics are specific for Xtend • Metric categories: • Extension metrics • Dependency metrics • Other metrics • Two types of metric: • Metrics that are measured over the entire transformation • Metrics that are measured on a smaller scale (per extension file, per extension… / Department of Mathematics and Computer Science 1-9-2010 PAGE 18

  20. Metrics for Xtend model transformations Extension metrics • # Extensions • # Create/Expression/Java Extensions • # Private/Public/Cached Extensions • # Extensions per Extension File • # Extensions with Parameter • # Overloaded Extensions • # Parameters per Extension • # Unused Parameters per Extension • Cyclomatic Complexity per Extension • … / Department of Mathematics and Computer Science 1-9-2010 PAGE 19

  21. Metrics for Xtend model transformations Dependency metrics • # Imported Standard Libraries per Extension File • # Imported Extension Files per Extension File • # Calls to Extensions in Standard Libraries per Extension • # Extension Calls per Extension • # Internal Extension Calls per Extension • # External Extension Calls per Extension • # Usages per Extension • … / Department of Mathematics and Computer Science 1-9-2010 PAGE 20

  22. Metrics for Xtend model transformations Other metrics • # Extension Files • # Imported Namespaces (Metamodels) per Extension File • # Arounds • # Checks / Department of Mathematics and Computer Science 1-9-2010 PAGE 21

  23. How the XtendParser works The XtendParser constructs an Abstract Syntax Tree while parsing an Xtend file. The transformation functions after parsing *.ext files are represented as an in-memory model consisting of POJO’s (Plain Old Java Objects). The basic type is org.eclipse.internal.xtend.expression.ast.SyntaxElement / Department of Mathematics and Computer Science 1-9-2010 PAGE 22

  24. Xtend AST

  25. Metric Extractor Tools • Design requirements • Input: Extension files • Output: Metrics • New metrics can be defined easily • It is possible to quickly implement the calculation of a new metric

  26. Metric Extractor Tools • In order to calculate the metrics, we need to extract data from the Xtend AST(s) to store in a well defined data model • “data” means all elements of Xtend model transformations • A well defined data model = data can be stored easily and metrics can be calculated easily.

  27. Metric Extractor Tools • Which data model? • Relational data model: No • Java Objects • Store data easily: The Xtend AST consists of Java Objects • Easily implementing metrics calculation in Java • XML • Store data of the Xtend AST in XML • Easily calculating metrics by using Xpath, Xquery

  28. Metric Extractor Tool 1 – M2M QA • Data model = Java Objects

  29. Class diagram of Java objects

  30. Class diagram of Data Extractor

  31. Simple Metrics

  32. Aggregate Metrics

  33. GUI for M2M QA Implement GUI, as a jar file Implement as an Eclipse plugin / Department of Mathematics and Computer Science 1-9-2010 PAGE 32

  34. Metric Extractor Tool 2 • Data model = XML • Native XML database eXist • XPath and XQuery are used for querying the XML data • GUI: A web application • Java, JavaBeans, JSP/Servlet and Java Server Faces. • Apache HTTP server Apache Tomcat 7.0. / Department of Mathematics and Computer Science 1-9-2010 PAGE 33

  35. Metric Extractor Tool 2

  36. DTD <!ELEMENTxtendPrj (extendFile*)> <!ATTLISTxtendPrj prjName CDATA#REQUIRED> <!ATTLISTxtendPrj prjDir CDATA#REQUIRED> <!ATTLISTxtendPrj rootExtFile CDATA#REQUIRED> <!ELEMENTextendFile (importedNamespaces|importedExtFiles|extensions|arounds|checks)*> <!ATTLISTextendFile extFileName CDATA#REQUIRED> <!ELEMENT importedNamespaces (namespace*)> <!ELEMENT namespace(#PCDATA)> <!ELEMENT importedExtFiles (extFileName*)> <!ELEMENT extFileName(#PCDATA)> <!ATTLIST extFileName reexported CDATA#REQUIRED> <!ELEMENT extensions (extension*)> <!ELEMENT extension (extName|qualifiedName|parameters|returnType|extBody)*> / Department of Mathematics and Computer Science 1-9-2010 PAGE 35

  37. XML <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE xtendPrj SYSTEM "xtendPrj.dtd"> <xtendPrj prjName="" prjDir="../my.slco.project/src/" rootExtFile="../my.slco.project/src/slco2nqx/Bi2Uni.ext"> <extendFile extFileName="../my.slco.project/src/slco2nqx/Bi2Uni.ext"> <importedNamespaces> <namespace>slco</namespace> <namespace>channels</namespace> </importedNamespaces> <importedExtFiles> / Department of Mathematics and Computer Science 1-9-2010 PAGE 36

  38. Xpath, XQuery # Extensions per Extension File: This metric counts the number of extensions per extension file. element { "result" } { for $extFile in doc("xtendM2M/Bi2Uni.xml")//extendFile return element { "extCountPerExtFile" } { count(for $ext in $extFile//extension return $ext) } / Department of Mathematics and Computer Science 1-9-2010 PAGE 37

  39. M2M QA Web Application Upload (zipped) extend files of an Xtend project Browse data Metrics calculation Search Download reports / Department of Mathematics and Computer Science 1-9-2010 PAGE 38

  40. M2M QA Web Application / Department of Mathematics and Computer Science 1-9-2010 PAGE 39

  41. Summary A set of metrics has been established to enabling quality assessment of Xtend model transformations Extension file(s) are parsed by the XtendParser to get the corresponding AST(s) 2 types of data model => 2 tools All the metrics can be automatically calculated by these two tools The results extracted from both tools are the same / Department of Mathematics and Computer Science 1-9-2010 PAGE 40

  42. The end. / Department of Mathematics and Computer Science 1-9-2010 PAGE 41

More Related