SlideShare a Scribd company logo
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
Game Theory Background
The Prisoner’s Dilemma



Context
Refactoring Software Systems:Why and How



Game Theory meets SE
Game-based Extract Class Refactoring



    contents
Game Theory
Background

    The Prisoner’s Dilemma
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
The Prisoner’s Dilemma

                                 Tom

                       confess     not confess

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

                                     Tom

                         confess       not confess
                       EQU NASH
          confess         (5, 5)
                          ILIB
                               RIU         (0, 7)
                                   M
 Sally
         not confess      (7, 0)           (4, 4)
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
Context

Refactoring Software Systems: Why and How
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
Focusing on Class Cohesion
           - How strongly related and focused the
            various responsibilites of a class are

           - High cohesion is desiderable ... easier
            maintenance

   class
  class
  class    - Programmers often add wrong
 class      responsibilities to a class
 class
class      - The class becomes too complex and its
class       cohesion decreases
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
Game Theory
meets SE
Game-based Extract Class Refactoring
no   M
                                                      n-c ode

Playing with Refactoring
                                                         oo   l
                                                            per ling
                                                               ati a
                                                                   ve
                                                                      ga
                                                                         me



             ..choosing the better strategy


                   T       m5

                 m2             m3             m4              N


  S    m2   (-1.00, -1.00) (0.49, 0.22)   (0.70, 0.80)    (0.70, 0.50)

       m3   (-0.49, -0.24) (-1.00, -1.00) (0.21, 0.58)    (0.21, 0.28)
  m1
       m4   (-0.70, -0.80) (-0.21, -0.58) (-1.00, -1.00) (0.00, -0.30)

       N    (-0.20, 0.00) (0.29, 0.22)    (0.50, 0.80) (-1.00, -1.00)
no   M
                                                              n-c ode

Playing with Refactoring
                                                                 oo   l
                                                                    per ling
                                                                       ati a
                                                                           ve
                                                                              ga
                                                                                 me



                     ..choosing the better strategy


(-1, -1) if i = j          T       m5

                         m2             m3             m4              N


     S       m2     (-1.00, -1.00) (0.49, 0.22)   (0.70, 0.80)    (0.70, 0.50)

             m3     (-0.49, -0.24) (-1.00, -1.00) (0.21, 0.58)    (0.21, 0.28)
     m1
             m4     (-0.70, -0.80) (-0.21, -0.58) (-1.00, -1.00) (0.00, -0.30)

              N     (-0.20, 0.00) (0.29, 0.22)    (0.50, 0.80) (-1.00, -1.00)
no   M
                                                      n-c ode

Playing with Refactoring
                                                         oo   l
                                                            per ling
                                                               ati a
                                                                   ve
                                                                      ga
                                                                         me



             ..choosing the better strategy


                   T       m5
                                  0.70 = sim(m1, m2) - sim(m1, m4)

                 m2             m3             m4              N


  S    m2   (-1.00, -1.00) (0.49, 0.22)   (0.70, 0.80)    (0.70, 0.50)

       m3   (-0.49, -0.24) (-1.00, -1.00) (0.21, 0.58)    (0.21, 0.28)
  m1
       m4   (-0.70, -0.80) (-0.21, -0.58) (-1.00, -1.00) (0.00, -0.30)

       N    (-0.20, 0.00) (0.29, 0.22)    (0.50, 0.80) (-1.00, -1.00)
no   M
                                                      n-c ode

Playing with Refactoring
                                                         oo   l
                                                            per ling
                                                               ati a
                                                                   ve
                                                                      ga
                                                                         me



             ..choosing the better strategy
                                          COHESION COUPLING

                   T       m5
                                  0.70 = sim(m1, m2) - sim(m1, m4)

                 m2             m3             m4              N


  S    m2   (-1.00, -1.00) (0.49, 0.22)   (0.70, 0.80)    (0.70, 0.50)

       m3   (-0.49, -0.24) (-1.00, -1.00) (0.21, 0.58)    (0.21, 0.28)
  m1
       m4   (-0.70, -0.80) (-0.21, -0.58) (-1.00, -1.00) (0.00, -0.30)

       N    (-0.20, 0.00) (0.29, 0.22)    (0.50, 0.80) (-1.00, -1.00)
no   M
                                                      n-c ode

Playing with Refactoring
                                                         oo   l
                                                            per ling
                                                               ati a
                                                                   ve
                                                                      ga
                                                                         me



             ..choosing the better strategy


                   T       m5

                 m2             m3             m4              N


  S    m2   (-1.00, -1.00) (0.49, 0.22)   (0.70, 0.80)    (0.70, 0.50)

       m3   (-0.49, -0.24) (-1.00, -1.00) (0.21, 0.58)    (0.21, 0.28)
  m1
       m4   (-0.70, -0.80) (-0.21, -0.58) (-1.00, -1.00) (0.00, -0.30)

       N    (-0.20, 0.00) (0.29, 0.22)    (0.50, 0.80) (-1.00, -1.00)
no   M
                                                      n-c ode

Playing with Refactoring
                                                         oo   l
                                                            per ling
                                                               ati a
                                                                   ve
                                                                      ga
                                                                         me



             ..choosing the better strategy


                   T       m5

                 m2             m3             m4              N

                                        EQU NASH
  S    m2   (-1.00, -1.00) (0.49, 0.22) (0.70,B
                                           ILI 0.80) (0.70, 0.50)
                                                RIU
                                                    M
       m3   (-0.49, -0.24) (-1.00, -1.00) (0.21, 0.58)    (0.21, 0.28)
  m1
       m4   (-0.70, -0.80) (-0.21, -0.58) (-1.00, -1.00) (0.00, -0.30)

       N    (-0.20, 0.00) (0.29, 0.22)    (0.50, 0.80) (-1.00, -1.00)
no   M
                                                      n-c ode

Playing with Refactoring
                                                         oo   l
                                                            per ling
                                                               ati a
                                                                   ve
                                                                      ga
                                                                         me



             ..choosing the better strategy


                   T       m5

                 m2             m3             m4              N

                                        EQU NASH
  S         (-1.00, -1.00) (0.49, 0.22) (0.70,B
                                           ILI 0.80) (0.70, 0.50)
                                                RIU
                                                    M
       m3   (-0.49, -0.24) (-1.00, -1.00) (0.21, 0.58)    (0.21, 0.28)
  m1
       m4   (-0.70, -0.80) (-0.21, -0.58) (-1.00, -1.00) (0.00, -0.30)
  m2
       N    (-0.20, 0.00) (0.29, 0.22)    (0.50, 0.80) (-1.00, -1.00)
no   M
                                                    n-c ode

Playing with Refactoring
                                                       oo   l
                                                          per ling
                                                             ati a
                                                                 ve
                                                                    ga
                                                                         me



             ..choosing the better strategy


                   T       m5    m4

                 m2             m3                            N

                                        EQU NASH
  S         (-1.00, -1.00) (0.49, 0.22) (0.70,B
                                           ILI 0.80) (0.70, 0.50)
                                                RIU
                                                    M
       m3   (-0.49, -0.24) (-1.00, -1.00) (0.21, 0.58)   (0.21, 0.28)
  m1
       m4   (-0.70, -0.80) (-0.21, -0.58) (-1.00, -1.00) (0.00, -0.30)
  m2
       N    (-0.20, 0.00) (0.29, 0.22)    (0.50, 0.80) (-1.00, -1.00)
no   M
                                                    n-c ode

Playing with Refactoring
                                                       oo   l
                                                          per ling
                                                             ati a
                                                                 ve
                                                                    ga
                                                                         me



             ..choosing the better strategy


                   T       m5    m4

                 m2             m3                            N

                                        EQU NASH
  S         (-1.00, -1.00) (0.49, 0.22) (0.70,B
                                           ILI 0.80) (0.70, 0.50)
                                                RIU
                                                    M
       m3   (-0.49, -0.24) (-1.00, -1.00) (0.21, 0.58)   (0.21, 0.28)
  m1
       m4   (-0.70, -0.80) (-0.21, -0.58) (-1.00, -1.00) (0.00, -0.30)
  m2
       N    (-0.20, 0.00) (0.29, 0.22)    (0.50, 0.80) (-1.00, -1.00)
no      M
                                                 n-c ode

Playing with Refactoring
                                                    oo   l
                                                       per ling
                                                          ati a
                                                              ve
                                                                 ga
                                                                   me



           ..choosing the better strategy


                  T   m5        m4


      S                    m3                N

             m3       (-1.00, -1.00)   (0.21, 0.28)
      m1


      m2
              N       (0.29, 0.22)     (-1.00, -1.00)
no      M
                                                 n-c ode

Playing with Refactoring
                                                    oo   l
                                                       per ling
                                                          ati a
                                                              ve
                                                                 ga
                                                                   me



           ..choosing the better strategy


                  T   m5        m4


      S                    m3                N

             m3       (-1.00, -1.00)   (0.21, 0.28)
      m1


      m2              EQU NASH
              N        (0.29,B0.22)
                          ILI          (-1.00, -1.00)
                              RIU
                                  M
no      M
                                                 n-c ode

Playing with Refactoring
                                                    oo   l
                                                       per ling
                                                          ati a
                                                              ve
                                                                 ga
                                                                   me



           ..choosing the better strategy


                  T   m5       m4      m3


      S                                      N

             m3       (-1.00, -1.00)   (0.21, 0.28)
      m1


      m2              EQU NASH
              N        (0.29,B0.22)
                          ILI          (-1.00, -1.00)
                              RIU
                                  M
no      M
                                                 n-c ode

Playing with Refactoring
                                                    oo   l
                                                       per ling
                                                          ati a
                                                              ve
                                                                 ga
                                                                   me



           ..choosing the better strategy


                  T   m5       m4      m3


      S                                      N

             m3       (-1.00, -1.00)   (0.21, 0.28)
      m1


      m2              EQU NASH
              N        (0.29,B0.22)
                          ILI          (-1.00, -1.00)
                              RIU
                                  M
Preliminary
Evaluation
 Game-based Extract Class Refactoring
Case Study Design

       Goal                                Systems          Metrics



 RQ1   Comparison with Pareto Optimum   ArgoUML, JHotDraw   F-measure




       Comparison with others Extract
 RQ2   Class Refactoring approaches
                                        ArgoUML, JHotDraw   F-measure
Experiment Execution
         original system                              mutated system
          Original Class                                Mutated Class
              Original
              Original                                     Original
                                                            Original
                Ci                                         Ci + Cj
                 Class C1                                      Class C1
          attr1 Class C1                                attr1 Class C1
 Input     attr1
          ...attr1            System mutation            attr1
                                                        ...attr1
                                                         ...
           ...
             ...                                           ...
          attrm                                         attrm+k
           attrm
             attrm                                       attrm
                                                           attrm
          method1                                       method1
           method11                                      method11
          ...method                                     ...method
           ...
             ...                                         ...
                                                           ...
          methodn                                       methodn+s
           methodsn
             method                                      methodyn
                                                           method



                                                                     System
                                                                   refactoring

             results
                                                          Refactored
                                                            Original
                                                            Original
                                                           Class C'i
          F-MEASURE                                            Class C1
                                                        attr1 Class C1
                                                         attr1
                            Comparision of orginal      ...attr1
                                                         ...
                                                           ...

             88%
                                                        attrh
                                                         attrm
                             and mutated system            attrm
                                                        method1
                                                         method11
                                                        ...method
                                                         ...
                                                           ...
                                                        methodk
                                                         methodsn
                                                           method
                                                     refactored system
Results
               Game      Pareto   MaxFlow
    System
               Theory   Optimum   MinCut


    ArgoUML     90%       88%       77%




    JHotDraw    85%       82%       76%
Conclusion and
Future Work
Conclusion...


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


       Preliminary evaluation of the
            proposed approach
...and Future Work
              direct comparison with clustering
                  and search-based approach



 investigate about other kind of games, e.g., cooperative game




       apply Game Theory to Software Re-modularization
Thank you!

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

More Related Content

More from Ptidej Team

Presentation by Lionel Briand
Presentation by Lionel BriandPresentation by Lionel Briand
Presentation by Lionel BriandPtidej Team
 
Manel Abdellatif
Manel AbdellatifManel Abdellatif
Manel AbdellatifPtidej Team
 
Azadeh Kermansaravi
Azadeh KermansaraviAzadeh Kermansaravi
Azadeh KermansaraviPtidej Team
 
CSED - Manel Grichi
CSED - Manel GrichiCSED - Manel Grichi
CSED - Manel GrichiPtidej Team
 
Cristiano Politowski
Cristiano PolitowskiCristiano Politowski
Cristiano PolitowskiPtidej Team
 
Will io t trigger the next software crisis
Will io t trigger the next software crisisWill io t trigger the next software crisis
Will io t trigger the next software crisisPtidej Team
 
Thesis+of+laleh+eshkevari.ppt
Thesis+of+laleh+eshkevari.pptThesis+of+laleh+eshkevari.ppt
Thesis+of+laleh+eshkevari.pptPtidej Team
 
Thesis+of+nesrine+abdelkafi.ppt
Thesis+of+nesrine+abdelkafi.pptThesis+of+nesrine+abdelkafi.ppt
Thesis+of+nesrine+abdelkafi.pptPtidej Team
 
Thesis+of+étienne+duclos.ppt
Thesis+of+étienne+duclos.pptThesis+of+étienne+duclos.ppt
Thesis+of+étienne+duclos.pptPtidej Team
 

More from Ptidej Team (20)

Presentation
PresentationPresentation
Presentation
 
Presentation
PresentationPresentation
Presentation
 
Presentation by Lionel Briand
Presentation by Lionel BriandPresentation by Lionel Briand
Presentation by Lionel Briand
 
Manel Abdellatif
Manel AbdellatifManel Abdellatif
Manel Abdellatif
 
Azadeh Kermansaravi
Azadeh KermansaraviAzadeh Kermansaravi
Azadeh Kermansaravi
 
Mouna Abidi
Mouna AbidiMouna Abidi
Mouna Abidi
 
CSED - Manel Grichi
CSED - Manel GrichiCSED - Manel Grichi
CSED - Manel Grichi
 
Cristiano Politowski
Cristiano PolitowskiCristiano Politowski
Cristiano Politowski
 
Will io t trigger the next software crisis
Will io t trigger the next software crisisWill io t trigger the next software crisis
Will io t trigger the next software crisis
 
MIPA
MIPAMIPA
MIPA
 
Thesis+of+laleh+eshkevari.ppt
Thesis+of+laleh+eshkevari.pptThesis+of+laleh+eshkevari.ppt
Thesis+of+laleh+eshkevari.ppt
 
Thesis+of+nesrine+abdelkafi.ppt
Thesis+of+nesrine+abdelkafi.pptThesis+of+nesrine+abdelkafi.ppt
Thesis+of+nesrine+abdelkafi.ppt
 
Medicine15.ppt
Medicine15.pptMedicine15.ppt
Medicine15.ppt
 
Qrs17b.ppt
Qrs17b.pptQrs17b.ppt
Qrs17b.ppt
 
Icpc11c.ppt
Icpc11c.pptIcpc11c.ppt
Icpc11c.ppt
 
Icsme16.ppt
Icsme16.pptIcsme16.ppt
Icsme16.ppt
 
Msr17a.ppt
Msr17a.pptMsr17a.ppt
Msr17a.ppt
 
Icsoc15.ppt
Icsoc15.pptIcsoc15.ppt
Icsoc15.ppt
 
Thesis+of+étienne+duclos.ppt
Thesis+of+étienne+duclos.pptThesis+of+étienne+duclos.ppt
Thesis+of+étienne+duclos.ppt
 
Icsoc16b.ppt
Icsoc16b.pptIcsoc16b.ppt
Icsoc16b.ppt
 

Recently uploaded

In-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT ProfessionalsIn-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT ProfessionalsExpeed Software
 
UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1DianaGray10
 
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...CzechDreamin
 
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...CzechDreamin
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaRTTS
 
Optimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityOptimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityScyllaDB
 
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptxWSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptxJennifer Lim
 
Strategic AI Integration in Engineering Teams
Strategic AI Integration in Engineering TeamsStrategic AI Integration in Engineering Teams
Strategic AI Integration in Engineering TeamsUXDXConf
 
AI presentation and introduction - Retrieval Augmented Generation RAG 101
AI presentation and introduction - Retrieval Augmented Generation RAG 101AI presentation and introduction - Retrieval Augmented Generation RAG 101
AI presentation and introduction - Retrieval Augmented Generation RAG 101vincent683379
 
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka DoktorováCzechDreamin
 
What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024Stephanie Beckett
 
Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераMark Opanasiuk
 
Intelligent Gimbal FINAL PAPER Engineering.pdf
Intelligent Gimbal FINAL PAPER Engineering.pdfIntelligent Gimbal FINAL PAPER Engineering.pdf
Intelligent Gimbal FINAL PAPER Engineering.pdfAnthony Lucente
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Jeffrey Haguewood
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Tobias Schneck
 
IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024IoTAnalytics
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonDianaGray10
 
Connecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAKConnecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAKUXDXConf
 
Motion for AI: Creating Empathy in Technology
Motion for AI: Creating Empathy in TechnologyMotion for AI: Creating Empathy in Technology
Motion for AI: Creating Empathy in TechnologyUXDXConf
 
IESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIES VE
 

Recently uploaded (20)

In-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT ProfessionalsIn-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT Professionals
 
UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1
 
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
 
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
Optimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityOptimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through Observability
 
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptxWSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
 
Strategic AI Integration in Engineering Teams
Strategic AI Integration in Engineering TeamsStrategic AI Integration in Engineering Teams
Strategic AI Integration in Engineering Teams
 
AI presentation and introduction - Retrieval Augmented Generation RAG 101
AI presentation and introduction - Retrieval Augmented Generation RAG 101AI presentation and introduction - Retrieval Augmented Generation RAG 101
AI presentation and introduction - Retrieval Augmented Generation RAG 101
 
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
 
What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024
 
Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджера
 
Intelligent Gimbal FINAL PAPER Engineering.pdf
Intelligent Gimbal FINAL PAPER Engineering.pdfIntelligent Gimbal FINAL PAPER Engineering.pdf
Intelligent Gimbal FINAL PAPER Engineering.pdf
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
Connecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAKConnecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAK
 
Motion for AI: Creating Empathy in Technology
Motion for AI: Creating Empathy in TechnologyMotion for AI: Creating Empathy in Technology
Motion for AI: Creating Empathy in Technology
 
IESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIESVE for Early Stage Design and Planning
IESVE for Early Stage Design and Planning
 

ICSM10b.ppt

  • 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 confess not confess confess (5, 5) (0, 7) Sally not confess (7, 0) (4, 4)
  • 6. The Prisoner’s Dilemma Tom confess not confess EQU NASH confess (5, 5) ILIB RIU (0, 7) M 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
  • 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 class class - Programmers often add wrong 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. no M n-c ode Playing with Refactoring oo l per ling ati a ve ga me ..choosing the better strategy T m5 m2 m3 m4 N S m2 (-1.00, -1.00) (0.49, 0.22) (0.70, 0.80) (0.70, 0.50) m3 (-0.49, -0.24) (-1.00, -1.00) (0.21, 0.58) (0.21, 0.28) m1 m4 (-0.70, -0.80) (-0.21, -0.58) (-1.00, -1.00) (0.00, -0.30) N (-0.20, 0.00) (0.29, 0.22) (0.50, 0.80) (-1.00, -1.00)
  • 14. no M n-c ode Playing with Refactoring oo l per ling ati a ve ga me ..choosing the better strategy (-1, -1) if i = j T m5 m2 m3 m4 N S m2 (-1.00, -1.00) (0.49, 0.22) (0.70, 0.80) (0.70, 0.50) m3 (-0.49, -0.24) (-1.00, -1.00) (0.21, 0.58) (0.21, 0.28) m1 m4 (-0.70, -0.80) (-0.21, -0.58) (-1.00, -1.00) (0.00, -0.30) N (-0.20, 0.00) (0.29, 0.22) (0.50, 0.80) (-1.00, -1.00)
  • 15. no M n-c ode Playing with Refactoring oo l per ling ati a ve ga me ..choosing the better strategy T m5 0.70 = sim(m1, m2) - sim(m1, m4) m2 m3 m4 N S m2 (-1.00, -1.00) (0.49, 0.22) (0.70, 0.80) (0.70, 0.50) m3 (-0.49, -0.24) (-1.00, -1.00) (0.21, 0.58) (0.21, 0.28) m1 m4 (-0.70, -0.80) (-0.21, -0.58) (-1.00, -1.00) (0.00, -0.30) N (-0.20, 0.00) (0.29, 0.22) (0.50, 0.80) (-1.00, -1.00)
  • 16. no M n-c ode Playing with Refactoring oo l per ling ati a ve ga me ..choosing the better strategy COHESION COUPLING T m5 0.70 = sim(m1, m2) - sim(m1, m4) m2 m3 m4 N S m2 (-1.00, -1.00) (0.49, 0.22) (0.70, 0.80) (0.70, 0.50) m3 (-0.49, -0.24) (-1.00, -1.00) (0.21, 0.58) (0.21, 0.28) m1 m4 (-0.70, -0.80) (-0.21, -0.58) (-1.00, -1.00) (0.00, -0.30) N (-0.20, 0.00) (0.29, 0.22) (0.50, 0.80) (-1.00, -1.00)
  • 17. no M n-c ode Playing with Refactoring oo l per ling ati a ve ga me ..choosing the better strategy T m5 m2 m3 m4 N S m2 (-1.00, -1.00) (0.49, 0.22) (0.70, 0.80) (0.70, 0.50) m3 (-0.49, -0.24) (-1.00, -1.00) (0.21, 0.58) (0.21, 0.28) m1 m4 (-0.70, -0.80) (-0.21, -0.58) (-1.00, -1.00) (0.00, -0.30) N (-0.20, 0.00) (0.29, 0.22) (0.50, 0.80) (-1.00, -1.00)
  • 18. no M n-c ode Playing with Refactoring oo l per ling ati a ve ga me ..choosing the better strategy T m5 m2 m3 m4 N EQU NASH S m2 (-1.00, -1.00) (0.49, 0.22) (0.70,B ILI 0.80) (0.70, 0.50) RIU M m3 (-0.49, -0.24) (-1.00, -1.00) (0.21, 0.58) (0.21, 0.28) m1 m4 (-0.70, -0.80) (-0.21, -0.58) (-1.00, -1.00) (0.00, -0.30) N (-0.20, 0.00) (0.29, 0.22) (0.50, 0.80) (-1.00, -1.00)
  • 19. no M n-c ode Playing with Refactoring oo l per ling ati a ve ga me ..choosing the better strategy T m5 m2 m3 m4 N EQU NASH S (-1.00, -1.00) (0.49, 0.22) (0.70,B ILI 0.80) (0.70, 0.50) RIU M m3 (-0.49, -0.24) (-1.00, -1.00) (0.21, 0.58) (0.21, 0.28) m1 m4 (-0.70, -0.80) (-0.21, -0.58) (-1.00, -1.00) (0.00, -0.30) m2 N (-0.20, 0.00) (0.29, 0.22) (0.50, 0.80) (-1.00, -1.00)
  • 20. no M n-c ode Playing with Refactoring oo l per ling ati a ve ga me ..choosing the better strategy T m5 m4 m2 m3 N EQU NASH S (-1.00, -1.00) (0.49, 0.22) (0.70,B ILI 0.80) (0.70, 0.50) RIU M m3 (-0.49, -0.24) (-1.00, -1.00) (0.21, 0.58) (0.21, 0.28) m1 m4 (-0.70, -0.80) (-0.21, -0.58) (-1.00, -1.00) (0.00, -0.30) m2 N (-0.20, 0.00) (0.29, 0.22) (0.50, 0.80) (-1.00, -1.00)
  • 21. no M n-c ode Playing with Refactoring oo l per ling ati a ve ga me ..choosing the better strategy T m5 m4 m2 m3 N EQU NASH S (-1.00, -1.00) (0.49, 0.22) (0.70,B ILI 0.80) (0.70, 0.50) RIU M m3 (-0.49, -0.24) (-1.00, -1.00) (0.21, 0.58) (0.21, 0.28) m1 m4 (-0.70, -0.80) (-0.21, -0.58) (-1.00, -1.00) (0.00, -0.30) m2 N (-0.20, 0.00) (0.29, 0.22) (0.50, 0.80) (-1.00, -1.00)
  • 22. no M n-c ode Playing with Refactoring oo l per ling ati a ve ga me ..choosing the better strategy T m5 m4 S m3 N m3 (-1.00, -1.00) (0.21, 0.28) m1 m2 N (0.29, 0.22) (-1.00, -1.00)
  • 23. no M n-c ode Playing with Refactoring oo l per ling ati a ve ga me ..choosing the better strategy T m5 m4 S m3 N m3 (-1.00, -1.00) (0.21, 0.28) m1 m2 EQU NASH N (0.29,B0.22) ILI (-1.00, -1.00) RIU M
  • 24. no M n-c ode Playing with Refactoring oo l per ling ati a ve ga me ..choosing the better strategy T m5 m4 m3 S N m3 (-1.00, -1.00) (0.21, 0.28) m1 m2 EQU NASH N (0.29,B0.22) ILI (-1.00, -1.00) RIU M
  • 25. no M n-c ode Playing with Refactoring oo l per ling ati a ve ga me ..choosing the better strategy T m5 m4 m3 S N m3 (-1.00, -1.00) (0.21, 0.28) m1 m2 EQU NASH N (0.29,B0.22) ILI (-1.00, -1.00) RIU M
  • 27. Case Study Design Goal Systems Metrics RQ1 Comparison with Pareto Optimum ArgoUML, JHotDraw F-measure Comparison with others Extract RQ2 Class Refactoring approaches ArgoUML, JHotDraw F-measure
  • 28. Experiment Execution original system mutated system Original Class Mutated Class Original Original Original Original Ci Ci + Cj Class C1 Class C1 attr1 Class C1 attr1 Class C1 Input attr1 ...attr1 System mutation attr1 ...attr1 ... ... ... ... attrm attrm+k attrm attrm attrm attrm method1 method1 method11 method11 ...method ...method ... ... ... ... methodn methodn+s methodsn method methodyn method System refactoring results Refactored Original Original Class C'i F-MEASURE Class C1 attr1 Class C1 attr1 Comparision of orginal ...attr1 ... ... 88% attrh attrm and mutated system attrm method1 method11 ...method ... ... methodk methodsn method refactored system
  • 29. Results Game Pareto MaxFlow System Theory Optimum MinCut ArgoUML 90% 88% 77% JHotDraw 85% 82% 76%
  • 31. Conclusion... The first recommendation system that exploits game theory techniques
  • 32. Conclusion... Preliminary evaluation of the proposed approach
  • 33. ...and Future Work direct comparison with clustering and search-based approach investigate about other kind of games, e.g., cooperative game 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