Upgrade to Pro — share decks privately, control downloads, hide ads and more …

System Specific, Source Code Transformations (ICSME 2015)

gustavojss
September 30, 2015

System Specific, Source Code Transformations (ICSME 2015)

During its lifetime, a software system might undergo a major transformation effort in its structure, for example to migrate to a new architecture or bring some drastic improvements to the system. Particularly in this context, we found evidences that some sequences of code changes are made in a systematic way. These sequences are composed of small code transformations (e.g., create a class, move a method) which are repeatedly applied to groups of related entities (e.g., a class and some of its methods). We define these sequences as transformation patterns. In this work, we identify examples of transformation patterns in real world software systems and study their properties: (i) they are specific to a system; (ii) they were applied manually; (iii) they were not always applied to all the software entities which could have been transformed; (iv) they were sometimes complex; and (v) they were not always applied in one shot but over several releases. These results suggest that transformation patterns could benefit from automated support in their application.

gustavojss

September 30, 2015
Tweet

More Decks by gustavojss

Other Decks in Research

Transcript

  1. Systematic Code Transformation JHotDraw 7.4.1 → 7.5.1 2 class HSLColorSpace

    extends ColorSpace { public HSLColorSpace() { /* … */ } // … } class HSLColorSpace extends ColorSpace implements NamedColorSpace { private static HSLColorSpace instance; public static HSLColorSpace getInstance() { /* … */ } private HSLColorSpace() { /* … */ } public String getName() { return “HSL”; } // … }
  2. Systematic Code Transformation JHotDraw 7.4.1 → 7.5.1 3 class HSVColorSpace

    extends ColorSpace { public HSVColorSpace() { /* … */ } // … } class HSVColorSpace extends ColorSpace implements NamedColorSpace { private static HSVColorSpace instance; public static HSVColorSpace getInstance() { /* … */ } private HSVColorSpace() { /* … */ } public String getName() { return “HSV”; } // … }
  3. Systematic Code Transformation JHotDraw 7.4.1 → 7.5.1 3 Applied 9

    times class HSVColorSpace extends ColorSpace { public HSVColorSpace() { /* … */ } // … } class HSVColorSpace extends ColorSpace implements NamedColorSpace { private static HSVColorSpace instance; public static HSVColorSpace getInstance() { /* … */ } private HSVColorSpace() { /* … */ } public String getName() { return “HSV”; } // … }
  4. Changes Operators Change Operators [Jav2012] 5 class HSVColorSpace extends ColorSpace

    implements NamedColorSpace { private static HSVColorSpace instance; public static HSVColorSpace getInstance() { /* … */ } private HSVColorSpace() { /* … */ } public String getName() { return “HSV”; } // … } class HSVColorSpace implements NamedColorSpace add static attribute instance add static method getInstance set visibility to private add method getName
  5. Changes Operators Change Operators [Jav2012] 5 class HSVColorSpace extends ColorSpace

    implements NamedColorSpace { private static HSVColorSpace instance; public static HSVColorSpace getInstance() { /* … */ } private HSVColorSpace() { /* … */ } public String getName() { return “HSV”; } // … } class HSVColorSpace implements NamedColorSpace add static attribute instance add static method getInstance set visibility to private add method getName Atomic and generic
  6. Changes Operators Change Operators [Jav2012] 5 class HSVColorSpace extends ColorSpace

    implements NamedColorSpace { private static HSVColorSpace instance; public static HSVColorSpace getInstance() { /* … */ } private HSVColorSpace() { /* … */ } public String getName() { return “HSV”; } // … } class HSVColorSpace implements NamedColorSpace add static attribute instance add static method getInstance set visibility to private add method getName Atomic and generic Aggregated, still generic
  7. Changes Operators Change Operators [Jav2012] 5 class HSVColorSpace extends ColorSpace

    implements NamedColorSpace { private static HSVColorSpace instance; public static HSVColorSpace getInstance() { /* … */ } private HSVColorSpace() { /* … */ } public String getName() { return “HSV”; } // … } class HSVColorSpace implements NamedColorSpace add static attribute instance add static method getInstance set visibility to private add method getName Atomic and generic Aggregated, still generic Aggregated, but system specific
  8. Express an abstract representation of operators class C implements NamedColorSpace

    add static attribute named instance in C add static method named getInstance in C set visibility of C() to private add method named getName in C 6
  9. Express an abstract representation of operators class C implements NamedColorSpace

    add static attribute named instance in C add static method named getInstance in C set visibility of C() to private add method named getName in C 6 for each class C extending ColorSpace class C implements NamedColorSpace add static attribute named instance in C add static method named getInstance in C set visibility of C() to private add method named getName in C
  10. Express an abstract representation of operators class C implements NamedColorSpace

    add static attribute named instance in C add static method named getInstance in C set visibility of C() to private add method named getName in C 6 for each class C extending ColorSpace class C implements NamedColorSpace add static attribute named instance in C add static method named getInstance in C set visibility of C() to private add method named getName in C Transformation Operator
  11. Express an abstract representation of operators class C implements NamedColorSpace

    add static attribute named instance in C add static method named getInstance in C set visibility of C() to private add method named getName in C 6 for each class C extending ColorSpace class C implements NamedColorSpace add static attribute named instance in C add static method named getInstance in C set visibility of C() to private add method named getName in C Transformation Operator Application Condition
  12. Express an abstract representation of operators class C implements NamedColorSpace

    add static attribute named instance in C add static method named getInstance in C set visibility of C() to private add method named getName in C Transformation Pattern 6 for each class C extending ColorSpace class C implements NamedColorSpace add static attribute named instance in C add static method named getInstance in C set visibility of C() to private add method named getName in C Transformation Operator Application Condition
  13. Evaluation Methodology Systems under rearchitecting in the past [San2014] We

    have the source code before and after the changes Compute the changes (e.g., Eclipse diff) Search for similar changes semi-automatically Identify the application condition 9
  14. RQ1 Can we identify instances of transformation patterns in other

    systems? 10 Occurrences Eclipse I 26 Eclipse II 72 JHotDraw 9 MyWebMarket 7 VerveineJ 3 PetitDelphi 19 PetitSQL 6 PackageManager I 66 PackageManager II 19 PackageManager III 64 PackageManager IV 7 Telescope — GeneticAlgorithms — Average 27
  15. RQ2 Are transformation patterns applied to all the transformation opportunities?

    11 Entities matching condition Occurrences Eclipse I 34 26 Eclipse II 86 70 JHotDraw 9 9 MyWebMarket 7 7 VerveineJ 3 3 PetitDelphi 19 15 PetitSQL 6 6 PackageManager I 66 66 PackageManager II 19 19 PackageManager III 64 64 PackageManager IV 7 7 Average 27
  16. RQ3 Are all the transformation operators in the transformation patterns

    applied to all the opportunities? JHotDraw 7.4.1 → 7.5.1 12 Applied 9 times
  17. RQ3 Are all the transformation operators in the transformation patterns

    applied to all the opportunities? JHotDraw 7.4.1 → 7.5.1 12 class HSBColorSpace extends ColorSpace implements NamedColorSpace { private static HSBColorSpace instance; public static HSBColorSpace getInstance() { /* … */ } public HSLColorSpace() { /* … */ } public String getName() { return “HSB”; } // … } Applied 9 times 3 times
  18. RQ3 Are all the transformation operators in the transformation patterns

    applied to all the opportunities? JHotDraw 7.4.1 → 7.5.1 12 class HSBColorSpace extends ColorSpace implements NamedColorSpace { private static HSBColorSpace instance; public static HSBColorSpace getInstance() { /* … */ } public HSLColorSpace() { /* … */ } public String getName() { return “HSB”; } // … } class CIELCHabColorSpace extends ColorSpace implements NamedColorSpace { public CIELCHabColorSpace() { /* … */ } public String getName() { return “CIE 1976 L*CHa*b*”; } // … } Applied 9 times 3 times 2 times
  19. RQ4 Are transformation patterns applied over several revisions? 13 Revision

    Occurrences Eclipse II 3.0 70 3.1 71 3.2 72 PetitDelphi 210 15 211 17 212 18 213 19
  20. Conclusions Developers sometimes perform changes systematically We found examples of

    transformation patterns in real software systems Developers missed transformation opportunities Automation of composite transformations is needed. 14
  21. System Specific, Source Code Transformations Gustavo Santos, Nicolas Anquetil, Anne

    Etien, Stéphane Ducasse, and Marco Tulio Valente http://gustavojss.github.io/