ATL Metrics

download ATL Metrics

of 8

Transcript of ATL Metrics

  • 8/6/2019 ATL Metrics

    1/8

    Metrics for ATL Model Transformations

    M.F. van Amstel

    Eindhoven, December 11, 2009

    1 ATL Metrics Summary

    1. Number of lines of code

    2. Number of lines of comments

    3. Number of units

    4. Number of transformation rules

    5. Number of helpers

    6. Number of children per matched rule

    7. Number of abstract transformation rules

    8. Number of parameters per operation helper

    9. Number of unused parameters per operation helper

    10. Number of helper overloadings

    11. Number of overloaded helpers

    12. Number of input patterns per rule

    13. Number of rules with a filter condition on an input pattern

    14. Number of matched rules per input pattern

    15. Number of rules per rule name

    16. Number of output patterns per rule17. Rule complexity increase

    18. Number of rules with a do section

    19. Number of statements per do section

    20. Number of rules with a using clause

    21. Number of variables per using clause

    22. Number of helpers with a let clause

    1

  • 8/6/2019 ATL Metrics

    2/8

    23. Number of variables per helper

    24. Number of unused variables

    25. Number of unused helpers

    26. Number of unused rules

    27. Number of direct copies

    28. Number of calls to resolveTemp

    29. Number of calls to helpers (helper fan-in)

    30. Number of calls from helpers to helpers (helper fan-out)

    31. Number of calls to built-in functions (built-in function fan-in)

    32. Number of calls by rules (rule fan-out)

    33. Number of calls to (unique) lazy rules (lazy rule fan-in)

    34. Number of calls to called rules (called rule fan-in)

    35. Number of calls from other units to helpers per unit (unit fan-in)

    36. Number of calls to helpers in other units per unit (unit fan-out)

    37. Number of input models

    38. Number of output models

    39. Number of library units

    40. Number of unused library units

    41. Number of times a unit is imported

    42. Number of println() statements

    43. Input metamodel coverage

    44. Output metamodel coverage

    2 ATL Metrics Detailled

    # Lines of Code

    This metric measures the number of lines of code in an ATL model transfor-mation. This metric can be measured in several ways, viz. with or withoutcomments, with or without empty lines.

    It is also possible to measure the lines of code per unit to get insight intothe relative sizes of the units in an ATL model transformation.

    # Lines of Comments

    This metric measures the number of lines containing comments in an ATL modeltransformation.

    2

  • 8/6/2019 ATL Metrics

    3/8

    # Units

    An ATL model transformation may consist of multiple units. This metric mea-sures the total number of units that together form an ATL model transforma-tion.

    # Transformation Rules

    This metric measures the number of transformation rules in an ATL modeltransformation. A distinction can be made between the different kinds of trans-formation rules, i.e.:

    Matched rules

    Called rules

    Lazy rules

    Unique lazy rules

    These metrics can also be measured per unit to get insight into the relativesize of a unit in an ATL model transformation.

    # Helpers

    ATL helpers make it possible to define factorized ATL code that can be calledfrom different points of an ATL model transformation.

    This metrics measures the number of helpers in an ATL model transforma-tion. A distinction can be made between:

    Helpers with context

    Helpers without context

    Helpers with parameters

    Helpers without parameters

    Attribute helpers

    TODO: Do we want to make this distinction?

    # Children per Matched Rule

    ATL supports rule inheritance, i.e., matched rules can have children. Thismetric measures the average number of (abstract) rules that inherit from atransformation rule.

    # Abstract Transformation Rules

    This metric is also related to rule inheritance. It measures the number of ab-stract transformation rules.

    TODO: Do we want to distinguish between the different rule types?

    3

  • 8/6/2019 ATL Metrics

    4/8

    # Parameters per Operation Helper

    An ATL operation helper can take any number of parameters. This metricmeasures the average number of parameters that helpers take.

    # Unused Parameters per Operation Helper

    This metric measures the average number of parameters that helpers take butare not used in the helper.

    # Helper Overloadings

    In ATL it is possible to define several helpers with the same name in a singletransformation. However, these must have distinct signatures to be distinguish-able by the ATL engine. We call this helper overloading.

    This metric measures the average number of overloadings per helper.

    # Overloaded Helpers

    A metric related to the previous one is the average number of overloaded helpers.

    # Input Patterns per Rule

    This metric measures the average number of input patterns per rule, i.e., thenumber of model elements it matches.

    # Rules with a Filter Condition on an Input Pattern

    To limit the amount of model elements a rule matches, filter conditions are used.This metric measures the number of rules that have a filter condition on an

    input pattern.

    # Matched Rules per Input Pattern

    Multiple rules can be made to match a similar input pattern, i.e., the modelelement is the same but the filter condition is different. This could be regardedas rule overloading and may be closely related to rule inheritance.

    This metric measures the average number of rules that match on a similarinput pattern.

    # Rules per Rule Name

    Multiple rules having the same name can be defined.This metric measures the amount of times a name of a rule is used er unique

    rule name.

    # Output Patterns per Rule

    This metric measures the average number of output patterns per rule.

    4

  • 8/6/2019 ATL Metrics

    5/8

    Rule Complexity Increase

    A rule may generate more or less output patterns from its input patterns. Theamount of complexity added to the target model by a rule can be measured asfollows:

    # output patterns

    # intput patterns

    This metric can also be calculated on the level of model element attributes.

    # Rules with a do Section

    ATL allows a user to specify imperative code in the do section of a rule.This metric measures the amount/percentage of rules that have a do section.

    # Statements per do SectionThis metric measures the average amount of statements per do section.

    It is also possible to measure the number of lines of imperative code inan ATL model transformation to get insight into the amount of code that isimperative.

    # Rules with a using Clause

    In rules it is possible to define variables in a using clause.This metric measures the amount of rules that define a variable.

    # Variables per rule (using Clause)

    This metric measures the average number of variables defined per using clause.

    # Helpers with a let Clause

    In helpers it is possible to define variables using let clauses.This metric measures the amount of helpers that define a variable.

    # Variables per Helper (let Clause)

    This metric measures the average number of variables defined using let clausesper helper. Note that only one variable can be defined per let clause andthat therefore this metric is the same as the average number of let clauses perhelper.

    # Unused Variables

    The number of variables that have been defined, but never used. Since variablescan be defined both in let clauses in helpers as well as in using clauses in rules,a distinction can be made between unused variables for helpers and rules.

    # Unused Helpers

    This metric measures the number of helpers that have been defined, but are notcalled by any other helper or rule in the same ATL model transformation.

    5

  • 8/6/2019 ATL Metrics

    6/8

    # Unused Rules

    This metric measures the number of called and (unique) lazy rules that havebeen defined, but are not called by any other rule in the same ATL modeltransformation.

    # Direct Copies

    This metric measures the number of rules that return as output pattern a directcopy of the input pattern, i.e., a

  • 8/6/2019 ATL Metrics

    7/8

    # Calls to Helpers in Other Units per Rule (Unit Rule Fan-Out)

    This metric measures the average number of calls to rules defined in anotherunit.

    # Calls to Helpers in Other Units per Helper (Unit Helper Fan-Out)

    This metric measures the average number of calls to helpers defined in anotherunit.

    # Input Models

    This metric measures the number of input models an ATL model transformationtakes.

    # Output Models

    This metric measures the number of output models an ATL model transforma-tion generates.

    # Imported Units

    This metric measures the average number of imported units per unit.

    # Unused Imported Units

    The number of library units in which no helper is called from another module.

    # Times a Unit is Imported

    This metric measures the average number of times units are imported by otherunits.

    # println() Statements

    This metric measures the number of println() statements in an ATL modeltransformation.

    println statements may be added to help in debugging an ATL model trans-formation.

    Input Metamodel Coverage

    This metric measures the percentage of the input metamodels elements (orattributes) that are matched with matched rules. The matched model elements(or attributes) are the ones that occur on the left-hand side of the input patternof rules.

    Output Metamodel Coverage

    This metric measures the percentage of the output metamodels elements (orattributes) that are generated with rules. The generated model elements (orattributes) are the ones that occur on the left-hand side of the output patternof rules.

    7

  • 8/6/2019 ATL Metrics

    8/8

    3 Metrics Calculation

    For most metrics we indicated that we measure an average. We can do more,e.g.:

    Minimum

    Maximum

    Average

    Median

    Standard Deviation

    4 Andres Vignagas Metrics

    This section contains the metrics defined by Andres Vignaga in [2] that havenot yet been defined in Section 1.

    1. Number of helpers per context

    2. Number of rule hierarchies

    3. Height of rule hierarchies

    4. Width of rule hierarchies

    5. Cyclomatic complexity of a helper

    6. Length of nested calls to helpers

    References

    [1] The Eclipse Foundation. ATL/User Guide - Eclipsipedia, 2009.

    [2] Andres Vignaga. Metrics for measuring ATL model transformations. Techni-cal report, MaTE, Department of Computer Science, Universidad de Chile,2009.

    8