playing with refactoring
play

Playing with Refactoring Identifying Extract Class Opportunities - PowerPoint PPT Presentation

Playing with Refactoring Identifying Extract Class Opportunities through Game Theory Gabriele Bavota*, Rocco Oliveto*, Andrea De Lucia* Giuliano Antoniol , Yann-Gal Guhneuc * DMI, University of Salerno, Fisciano (SA), Italy


  1. Playing with Refactoring Identifying Extract Class Opportunities through Game Theory Gabriele Bavota*, Rocco Oliveto*, Andrea De Lucia* Giuliano Antoniol ✝ , Yann-Gaël Guéhéneuc ✝ * DMI, University of Salerno, Fisciano (SA), Italy ✝ DGIGL, École Polytechnique de Montreál, Québec, Canada

  2. Game Theory Background The Prisoner’s Dilemma Context Refactoring Software Systems: Why and How Game Theory meets SE Game-based Extract Class Refactoring contents

  3. Game Theory Background The Prisoner’s Dilemma

  4. Game Theory - is a branch of mathematics widely applied in the social sciences - capture behavior in strategic situations, in which an individual’s success in making choices depends on the choices of others - a game consists of : • a set of players (2 or more); • a set of moves available to those players; • payoffs for each combination of moves

  5. The Prisoner’s Dilemma Tom Tom confess not confess confess (5, 5) (0, 7) Sally Sally not confess (7, 0) (4, 4)

  6. The Prisoner’s Dilemma Tom Tom confess not confess N A E S confess (5, 5) (0, 7) Q H U I L I B R I U M Sally Sally not confess (7, 0) (4, 4)

  7. Game Theory: Summarizing - Natural application in strategic situations - How to find a compromise between contrasting goals (Nash Equilibrium) - In software engineering : • optimal solution to many problems involves finding a compromise between contrasting goals, e.g., create classes with high cohesion and low coupling

  8. Context Refactoring Software Systems: Why and How

  9. Refactoring ... Why? ? - Changing software without modifying its external behaviour - Improve non-functional attributes of the software - Software evolution ... continuous changes - Changes cause a drift of the original design, reducing its quality, e.g., Class Cohesion

  10. Focusing on Class Cohesion - How strongly related and focused the various responsibilites of a class are - High cohesion is desiderable ... easier maintenance class - Programmers often add wrong class class class responsibilities to a class class class - The class becomes too complex and its class cohesion decreases

  11. Focusing on Class Cohesion - How strongly related and focused the various responsibilites of a class are - High cohesion is desiderable ... easier maintenance class Extract Class Refactoring Splitting a class with many responsibilities class class into different classes

  12. Game Theory meets SE Game-based Extract Class Refactoring

  13. non-cooperative game Modelling a Playing with Refactoring y t e g s t r a t t e r e b e g t h o s i n c h o . . T m 5 m 4 N m 3 m 2 (-1.00, -1.00) (0.49, 0.22) (0.70, 0.80) (0.70, 0.50) m 2 S (-0.49, -0.24) (-1.00, -1.00) (0.21, 0.58) (0.21, 0.28) m 3 m 1 (-0.70, -0.80) (-0.21, -0.58) (-1.00, -1.00) (0.00, -0.30) m 4 (-0.20, 0.00) (0.29, 0.22) (0.50, 0.80) (-1.00, -1.00) N

  14. non-cooperative game Modelling a Playing with Refactoring y t e g s t r a t t e r e b e g t h o s i n c h o . . T m 5 ( -1, -1 ) if i = j m 4 N m 3 m 2 (-1.00, -1.00) (0.49, 0.22) (0.70, 0.80) (0.70, 0.50) m 2 S (-0.49, -0.24) (-1.00, -1.00) (0.21, 0.58) (0.21, 0.28) m 3 m 1 (-0.70, -0.80) (-0.21, -0.58) (-1.00, -1.00) (0.00, -0.30) m 4 (-0.20, 0.00) (0.29, 0.22) (0.50, 0.80) (-1.00, -1.00) N

  15. non-cooperative game Modelling a Playing with Refactoring y t e g s t r a t t e r e b e g t h o s i n c h o . . 0.70 = sim(m 1 , m 2 ) - sim(m 1 , m 4 ) T m 5 m 4 N m 3 m 2 (-1.00, -1.00) (0.49, 0.22) (0.70, 0.80) (0.70, 0.50) m 2 S (-0.49, -0.24) (-1.00, -1.00) (0.21, 0.58) (0.21, 0.28) m 3 m 1 (-0.70, -0.80) (-0.21, -0.58) (-1.00, -1.00) (0.00, -0.30) m 4 (-0.20, 0.00) (0.29, 0.22) (0.50, 0.80) (-1.00, -1.00) N

  16. non-cooperative game Modelling a Playing with Refactoring y t e g s t r a t t e r e b e g t h o s i n c h o . . COHESION COUPLING 0.70 = sim(m 1 , m 2 ) - sim(m 1 , m 4 ) T m 5 m 4 N m 3 m 2 (-1.00, -1.00) (0.49, 0.22) (0.70, 0.80) (0.70, 0.50) m 2 S (-0.49, -0.24) (-1.00, -1.00) (0.21, 0.58) (0.21, 0.28) m 3 m 1 (-0.70, -0.80) (-0.21, -0.58) (-1.00, -1.00) (0.00, -0.30) m 4 (-0.20, 0.00) (0.29, 0.22) (0.50, 0.80) (-1.00, -1.00) N

  17. non-cooperative game Modelling a Playing with Refactoring y t e g s t r a t t e r e b e g t h o s i n c h o . . T m 5 m 4 N m 3 m 2 (-1.00, -1.00) (0.49, 0.22) (0.70, 0.80) (0.70, 0.50) m 2 S (-0.49, -0.24) (-1.00, -1.00) (0.21, 0.58) (0.21, 0.28) m 3 m 1 (-0.70, -0.80) (-0.21, -0.58) (-1.00, -1.00) (0.00, -0.30) m 4 (-0.20, 0.00) (0.29, 0.22) (0.50, 0.80) (-1.00, -1.00) N

  18. non-cooperative game Modelling a Playing with Refactoring y t e g s t r a t t e r e b e g t h o s i n c h o . . T m 5 m 4 N m 3 m 2 NASH EQUILIBRIUM (-1.00, -1.00) (0.49, 0.22) (0.70, 0.80) (0.70, 0.50) m 2 S (-0.49, -0.24) (-1.00, -1.00) (0.21, 0.58) (0.21, 0.28) m 3 m 1 (-0.70, -0.80) (-0.21, -0.58) (-1.00, -1.00) (0.00, -0.30) m 4 (-0.20, 0.00) (0.29, 0.22) (0.50, 0.80) (-1.00, -1.00) N

  19. non-cooperative game Modelling a Playing with Refactoring y t e g s t r a t t e r e b e g t h o s i n c h o . . T m 5 m 4 N m 3 m 2 NASH EQUILIBRIUM (-1.00, -1.00) (0.49, 0.22) (0.70, 0.80) (0.70, 0.50) S (-0.49, -0.24) (-1.00, -1.00) (0.21, 0.58) (0.21, 0.28) m 3 m 1 (-0.70, -0.80) (-0.21, -0.58) (-1.00, -1.00) (0.00, -0.30) m 4 m 2 (-0.20, 0.00) (0.29, 0.22) (0.50, 0.80) (-1.00, -1.00) N

  20. non-cooperative game Modelling a Playing with Refactoring y t e g s t r a t t e r e b e g t h o s i n c h o . . T m 5 m 4 N m 3 m 2 NASH EQUILIBRIUM (-1.00, -1.00) (0.49, 0.22) (0.70, 0.80) (0.70, 0.50) S (-0.49, -0.24) (-1.00, -1.00) (0.21, 0.58) (0.21, 0.28) m 3 m 1 (-0.70, -0.80) (-0.21, -0.58) (-1.00, -1.00) (0.00, -0.30) m 4 m 2 (-0.20, 0.00) (0.29, 0.22) (0.50, 0.80) (-1.00, -1.00) N

  21. non-cooperative game Modelling a Playing with Refactoring y t e g s t r a t t e r e b e g t h o s i n c h o . . T m 5 m 4 N m 3 m 2 NASH EQUILIBRIUM (-1.00, -1.00) (0.49, 0.22) (0.70, 0.80) (0.70, 0.50) S (-0.49, -0.24) (-1.00, -1.00) (0.21, 0.58) (0.21, 0.28) m 3 m 1 (-0.70, -0.80) (-0.21, -0.58) (-1.00, -1.00) (0.00, -0.30) m 4 m 2 (-0.20, 0.00) (0.29, 0.22) (0.50, 0.80) (-1.00, -1.00) N

  22. non-cooperative game Modelling a Playing with Refactoring y t e g s t r a t t e r e b e g t h o s i n c h o . . T m 5 m 4 m 3 N S (-1.00, -1.00) (0.21, 0.28) m 3 m 1 m 2 (-1.00, -1.00) (0.29, 0.22) N

  23. non-cooperative game Modelling a Playing with Refactoring y t e g s t r a t t e r e b e g t h o s i n c h o . . T m 5 m 4 m 3 N S (-1.00, -1.00) (0.21, 0.28) m 3 m 1 NASH m 2 EQUILIBRIUM (-1.00, -1.00) (0.29, 0.22) N

  24. non-cooperative game Modelling a Playing with Refactoring y t e g s t r a t t e r e b e g t h o s i n c h o . . T m 5 m 4 m 3 N S (-1.00, -1.00) (0.21, 0.28) m 3 m 1 NASH m 2 EQUILIBRIUM (-1.00, -1.00) (0.29, 0.22) N

  25. non-cooperative game Modelling a Playing with Refactoring y t e g s t r a t t e r e b e g t h o s i n c h o . . T m 5 m 4 m 3 N S (-1.00, -1.00) (0.21, 0.28) m 3 m 1 NASH m 2 EQUILIBRIUM (-1.00, -1.00) (0.29, 0.22) N

  26. Preliminary Evaluation Game-based Extract Class Refactoring

  27. Case Study Design Goal Systems Metrics RQ 1 Comparison with Pareto Optimum ArgoUML, JHotDraw F-measure Comparison with others Extract RQ 2 ArgoUML, JHotDraw F-measure Class Refactoring approaches

  28. Experiment Execution original system mutated system Mutated Class Original Class Original Original Original Original C i + C j C i Class C1 Class C1 Class C1 Class C1 attr 1 attr 1 Input System mutation attr 1 attr 1 attr 1 attr 1 ... ... ... ... ... ... attr m+k attr m attr m attr m attr m attr m method 1 method 1 method 1 method 1 method 1 method 1 ... ... ... ... ... ... method n+s method n method y method s method n method n System refactoring results Refactored Original Original Class C' i F-MEASURE Class C1 Class C1 attr 1 attr 1 Comparision of orginal attr 1 ... ... % ... attr h 8 8 attr m and mutated system attr m method 1 method 1 method 1 ... ... ... method k method s method n refactored system

  29. Results Game Pareto MaxFlow System Theory Optimum MinCut ArgoUML 90% 88% 77% JHotDraw 85% 82% 76%

  30. Conclusion and Future Work

  31. Conclusion... The first recommendation system that exploits game theory techniques

  32. Conclusion... Preliminary evaluation of the proposed approach

  33. ...and Future Work r i n g u s t e t h c l n w i r i s o m p a t c o i r e c d h o a c a p p r s e d h - b a a r c d s e a n i n v e s t i g a t e a b o u t o t h e r k i n d o f g a m e s , e . g . , c o o p e r a t i v e g a m e apply Game Theory to Software Re-modularization

  34. Thank you! Questions and/or comments Gabriele Bavota PhD Student DMI - University of Salerno gbavota@unisa.it

Recommend


More recommend