SlideShare uma empresa Scribd logo
1 de 24
Baixar para ler offline
Identifying overly strong conditions
                in refactoring implementations

                                           Gustavo Soares
                                           Melina Mongiovi
                                            Rohit Gheyi


                                           gsoares@dsc.ufcg.edu.br
                                     Federal University of Campina Grande




terça-feira, 11 de outubro de 2011
Employee
                                            ...




                                      Salesman               Engineer
                                     ...                ...
                                     name               name




                                      Duplicated code

                                                        2
terça-feira, 11 de outubro de 2011
Pull Up Field Refactoring
                                                Refactoring
                        Employee                 engines                   Employee
                  ...                                                    ...
                                                                         name



       Salesman                      Engineer
   ...                           ...                                Salesman           Engineer
   name                          name                         ...                ...



                                          Precondition
                            The name field is not declared in class Employee


                                                      3
terça-feira, 11 de outubro de 2011
It’s difficult to specify and
                          implement preconditions




                                     preconditions




                                         4
terça-feira, 11 de outubro de 2011
Problem


               Overly	
  strong	
  condi0ons
               prevent	
  safe	
  
               transforma+ons
                                      Implemented
                                         preconditions
                                                                Overly	
  weak
                                                         condi0ons	
  allow
                                                   unsafe	
  transforma+ons

                                               5
terça-feira, 11 de outubro de 2011
Motivating example
                                     A
                                               JRRT

                                                           GetF() cannot access
                                     B
                                                                variable f
                                            Pull up field
                           private int f
                           int getF() : f




                                                 6
terça-feira, 11 de outubro de 2011
A                       Overly strong
                                         JRRT

                                                     GetF() cannot access
                               B
                                                          variable f
                                      Pull up field
                     private int f
                     int getF() : f


                             A                                A
                                                      protected int f




                             B                               B
                                      Pull up field
                    private int f                     int getF() : f
                    int getF() : f

                                              7
terça-feira, 11 de outubro de 2011
Identifying overly strong
                      conditions

                       An evaluation on 3 refactoring engines


                                               JRRT



                                           8
terça-feira, 11 de outubro de 2011
Testing
                                             input




                                            expected
                                             output




                                        9
terça-feira, 11 de outubro de 2011
Testing
                                      input                  engine




                                     expected
                                      output



                                                             output
                                                          Overly strong
                                                   10
terça-feira, 11 de outubro de 2011
Exhaustively generating programs
        input




     Overly
     Strong                          Differential testing
   conditions

                                                                   Overly Strong
                                                                    Condition




                                                11
terça-feira, 11 de outubro de 2011
2 Class, 2 Method, 2 Field
                                     One subclass declaring a field




                                                    12
terça-feira, 11 de outubro de 2011
2 Class, 2 Method, 2 Field
                                     One subclass declaring a field




       Java Meta model                        Alloy Solutions            Java programs
                                                                     public class Class0 {
                                                                     public int method2(){ { {
                                                                      public class Class0
                                                                        public class Class0
                                                                      public int method2(){
                                                                          return 10;
                                                                        public int method2(){
                                                                      } return 10;
                                                                             return 10;
                                                                     } }}
                                                                      }
                                                                     class Class1 extends Class0 {
                                                                        }
                                                                      class Class1 extends Class0 {
                                                                      public int method1(){ Class0 {
                                                                        class Class1 extends
                                                                        public int method1(){
                                                                          return 20; method1(){
                                                                           public int
                                                                      } return 20;
                                                                        } return 20;
                                                                      public int method2(){
                                                                           }
                                                                        public int method2(){
                                                                          super.k(); method2(){
                                                                           public int
                                                                      } super.k();
                                                                             super.k();
                                                                     } }}
                                                                      }
                                                                        }



                                                     13
terça-feira, 11 de outubro de 2011
Exhaustively generating programs
        input




    expected
     output                          Differential testing


                                                                   Overly Strong
                                                                    Condition




                                                14
terça-feira, 11 de outubro de 2011
B.getF
                   A                                                          A
                                                                      protected int f




                   B                                                         B
                                        0/4                0/4
         private int f                                                int getF() : f
         int getF() : f                           4




                                     No behavioral change was found




                                                      15
terça-feira, 11 de outubro de 2011
Classifying
                    overly strong
                   preconditions
Technique




                    Differential
                      testing




                                    16
                                         terça-feira, 11 de outubro de 2011
            SPEC
Classifying overly strong
                     conditions
   A.test	
  cannot	
  access	
  method	
  A.k
                                                      OTC
     B.m	
  cannot	
  access	
  method	
  B.n               cannot	
  access	
  method


   C.test	
  cannot	
  access	
  method	
  C.k




                                                 17
terça-feira, 11 de outubro de 2011
Evaluation




                                         18
terça-feira, 11 de outubro de 2011
Up to 10 refactorings
                           Refactoring   Eclipse   JRRT   NetBeans
                       Rename Class        X        X        X
                     Rename Method         X        X        X
                       Rename Field        X        X        X
                    Push Down Method       X        X        X
                     Push Down Field       X        X        X
                      Pull Up Method       X        X        X
                       Pull Up Field       X        X        X
                     Encapsulate Field     X        X
                       Move Method         X        X
                      Add Parameter        X        X


                2 Packages, 3 classes, 4 methods, 2 fields
                                             19
terça-feira, 11 de outubro de 2011
Results
                                                    Rejected Beh. Pres.     Overly Strong Condition
        Refactoring                  Program
                                               Ecl        JRRT       NetB   Ecl      JRRT      NetB
      Rename Class                    4660     446          0         0      2         0        0
     Rename Method                    4752     4802       419         0      4        1         0
      Rename Field                    3168      200        0          0      2        0         0
  Push Down Method                    9366      59         40         0      1        1         0
    Push Down Field                   4800      0           0         0      0        0         0
     Pull Up Method                   10322    251        398         0      2        2         0
       Pull Up Field                  4320     744        584         0      1        1         0
    Encapsulate Field                  900     176        1536        -      1        1         -
      Move Method                     3002     367        135         -      2        1         -
     Add Parameter                    4279      79          0         -      2        0         -
             Total                    42774    7124       3112        0     17        7         0

                                                                20
terça-feira, 11 de outubro de 2011
JRRT feedback
                          Refactoring               Strong conditions
                          Rename Method                 overriding	
  has	
  changed

                        Push Down Method                cannot	
  access	
  method

                                                            method	
  is	
  used
                           Pull Up Method
                                                        cannot	
  access	
  method

                             Pull Up Field              cannot	
  access	
  variable	
  

                          Encapsulate Field         cannot	
  insert	
  method	
  here


                            Move Method       cannot	
  inline	
  ambiguous	
  method	
  call


                                                   21
terça-feira, 11 de outubro de 2011
JRRT feedback
     Refactoring                            Strong conditions                                    Cause
      Rename Method                           overriding	
  has	
  changed                     precondi+on
   Push Down Method                            cannot	
  access	
  method                   incorrect	
  analysis

                                                   method	
  is	
  used                     incorrect	
  analysis
      Pull Up Method
                                               cannot	
  access	
  method                   incorrect	
  analysis

         Pull Up Field                         cannot	
  access	
  variable	
           feature	
  not	
  implemented

     Encapsulate Field                      cannot	
  insert	
  method	
  here          feature	
  not	
  implemented


        Move Method                   cannot	
  inline	
  ambiguous	
  method	
  call       incorrect	
  analysis


                                                             22
terça-feira, 11 de outubro de 2011
Conclusions
     Differential
       Testing


                  +                    Implemented
                                         preconditions




      overly strong conditions + overly weak conditions

                                            23
terça-feira, 11 de outubro de 2011
Identifying overly strong conditions
                in refactoring implementations

                                           Gustavo Soares
                                           Melina Mongiovi
                                            Rohit Gheyi


                                           gsoares@dsc.ufcg.edu.br
                                     Federal University of Campina Grande




                                                      24
terça-feira, 11 de outubro de 2011

Mais conteúdo relacionado

Destaque

ERA - A Comparison of Stemmers on Source Code Identifiers for Software Search
ERA - A Comparison of Stemmers on Source Code Identifiers for Software SearchERA - A Comparison of Stemmers on Source Code Identifiers for Software Search
ERA - A Comparison of Stemmers on Source Code Identifiers for Software SearchICSM 2011
 
Industry - Testing & Quality Assurance in Data Migration Projects
Industry - Testing & Quality Assurance in Data Migration Projects Industry - Testing & Quality Assurance in Data Migration Projects
Industry - Testing & Quality Assurance in Data Migration Projects ICSM 2011
 
Natural Language Analysis - Mining Java Class Naming Conventions
Natural Language Analysis - Mining Java Class Naming ConventionsNatural Language Analysis - Mining Java Class Naming Conventions
Natural Language Analysis - Mining Java Class Naming ConventionsICSM 2011
 
Industry - Evolution and migration - Incremental and Iterative Reengineering ...
Industry - Evolution and migration - Incremental and Iterative Reengineering ...Industry - Evolution and migration - Incremental and Iterative Reengineering ...
Industry - Evolution and migration - Incremental and Iterative Reengineering ...ICSM 2011
 
Industry - Estimating software maintenance effort from use cases an indu...
Industry - Estimating software maintenance effort from use cases an      indu...Industry - Estimating software maintenance effort from use cases an      indu...
Industry - Estimating software maintenance effort from use cases an indu...ICSM 2011
 
Postdoc Symposium - Abram Hindle
Postdoc Symposium - Abram HindlePostdoc Symposium - Abram Hindle
Postdoc Symposium - Abram HindleICSM 2011
 
Industry - The Evolution of Information Systems. A Case Study on Document Man...
Industry - The Evolution of Information Systems. A Case Study on Document Man...Industry - The Evolution of Information Systems. A Case Study on Document Man...
Industry - The Evolution of Information Systems. A Case Study on Document Man...ICSM 2011
 
Components - Crossing the Boundaries while Analyzing Heterogeneous Component-...
Components - Crossing the Boundaries while Analyzing Heterogeneous Component-...Components - Crossing the Boundaries while Analyzing Heterogeneous Component-...
Components - Crossing the Boundaries while Analyzing Heterogeneous Component-...ICSM 2011
 
Impact Analysis - ImpactScale: Quantifying Change Impact to Predict Faults in...
Impact Analysis - ImpactScale: Quantifying Change Impact to Predict Faults in...Impact Analysis - ImpactScale: Quantifying Change Impact to Predict Faults in...
Impact Analysis - ImpactScale: Quantifying Change Impact to Predict Faults in...ICSM 2011
 
Richard Kemmerer Keynote icsm11
Richard Kemmerer Keynote icsm11Richard Kemmerer Keynote icsm11
Richard Kemmerer Keynote icsm11ICSM 2011
 
Lionel Briand ICSM 2011 Keynote
Lionel Briand ICSM 2011 KeynoteLionel Briand ICSM 2011 Keynote
Lionel Briand ICSM 2011 KeynoteICSM 2011
 
Metrics - Using Source Code Metrics to Predict Change-Prone Java Interfaces
Metrics - Using Source Code Metrics to Predict Change-Prone Java InterfacesMetrics - Using Source Code Metrics to Predict Change-Prone Java Interfaces
Metrics - Using Source Code Metrics to Predict Change-Prone Java InterfacesICSM 2011
 
Traceability - Structural Conformance Checking with Design Tests: An Evaluati...
Traceability - Structural Conformance Checking with Design Tests: An Evaluati...Traceability - Structural Conformance Checking with Design Tests: An Evaluati...
Traceability - Structural Conformance Checking with Design Tests: An Evaluati...ICSM 2011
 
ICSM'01 Most Influential Paper - Rainer Koschke
ICSM'01 Most Influential Paper - Rainer KoschkeICSM'01 Most Influential Paper - Rainer Koschke
ICSM'01 Most Influential Paper - Rainer KoschkeICSM 2011
 
Impact analysis - A Seismology-inspired Approach to Study Change Propagation
Impact analysis - A Seismology-inspired Approach to Study Change PropagationImpact analysis - A Seismology-inspired Approach to Study Change Propagation
Impact analysis - A Seismology-inspired Approach to Study Change PropagationICSM 2011
 
ERA - Clustering and Recommending Collections of Code Relevant to Task
ERA - Clustering and Recommending Collections of Code Relevant to TaskERA - Clustering and Recommending Collections of Code Relevant to Task
ERA - Clustering and Recommending Collections of Code Relevant to TaskICSM 2011
 
Postdoc symposium - A Logic Meta-Programming Foundation for Example-Driven Pa...
Postdoc symposium - A Logic Meta-Programming Foundation for Example-Driven Pa...Postdoc symposium - A Logic Meta-Programming Foundation for Example-Driven Pa...
Postdoc symposium - A Logic Meta-Programming Foundation for Example-Driven Pa...ICSM 2011
 
Components - Graph Based Detection of Library API Limitations
Components - Graph Based Detection of Library API LimitationsComponents - Graph Based Detection of Library API Limitations
Components - Graph Based Detection of Library API LimitationsICSM 2011
 
Faults and Regression testing - Localizing Failure-Inducing Program Edits Bas...
Faults and Regression testing - Localizing Failure-Inducing Program Edits Bas...Faults and Regression testing - Localizing Failure-Inducing Program Edits Bas...
Faults and Regression testing - Localizing Failure-Inducing Program Edits Bas...ICSM 2011
 
Natural Language Analysis - Expanding Identifiers to Normalize Source Code Vo...
Natural Language Analysis - Expanding Identifiers to Normalize Source Code Vo...Natural Language Analysis - Expanding Identifiers to Normalize Source Code Vo...
Natural Language Analysis - Expanding Identifiers to Normalize Source Code Vo...ICSM 2011
 

Destaque (20)

ERA - A Comparison of Stemmers on Source Code Identifiers for Software Search
ERA - A Comparison of Stemmers on Source Code Identifiers for Software SearchERA - A Comparison of Stemmers on Source Code Identifiers for Software Search
ERA - A Comparison of Stemmers on Source Code Identifiers for Software Search
 
Industry - Testing & Quality Assurance in Data Migration Projects
Industry - Testing & Quality Assurance in Data Migration Projects Industry - Testing & Quality Assurance in Data Migration Projects
Industry - Testing & Quality Assurance in Data Migration Projects
 
Natural Language Analysis - Mining Java Class Naming Conventions
Natural Language Analysis - Mining Java Class Naming ConventionsNatural Language Analysis - Mining Java Class Naming Conventions
Natural Language Analysis - Mining Java Class Naming Conventions
 
Industry - Evolution and migration - Incremental and Iterative Reengineering ...
Industry - Evolution and migration - Incremental and Iterative Reengineering ...Industry - Evolution and migration - Incremental and Iterative Reengineering ...
Industry - Evolution and migration - Incremental and Iterative Reengineering ...
 
Industry - Estimating software maintenance effort from use cases an indu...
Industry - Estimating software maintenance effort from use cases an      indu...Industry - Estimating software maintenance effort from use cases an      indu...
Industry - Estimating software maintenance effort from use cases an indu...
 
Postdoc Symposium - Abram Hindle
Postdoc Symposium - Abram HindlePostdoc Symposium - Abram Hindle
Postdoc Symposium - Abram Hindle
 
Industry - The Evolution of Information Systems. A Case Study on Document Man...
Industry - The Evolution of Information Systems. A Case Study on Document Man...Industry - The Evolution of Information Systems. A Case Study on Document Man...
Industry - The Evolution of Information Systems. A Case Study on Document Man...
 
Components - Crossing the Boundaries while Analyzing Heterogeneous Component-...
Components - Crossing the Boundaries while Analyzing Heterogeneous Component-...Components - Crossing the Boundaries while Analyzing Heterogeneous Component-...
Components - Crossing the Boundaries while Analyzing Heterogeneous Component-...
 
Impact Analysis - ImpactScale: Quantifying Change Impact to Predict Faults in...
Impact Analysis - ImpactScale: Quantifying Change Impact to Predict Faults in...Impact Analysis - ImpactScale: Quantifying Change Impact to Predict Faults in...
Impact Analysis - ImpactScale: Quantifying Change Impact to Predict Faults in...
 
Richard Kemmerer Keynote icsm11
Richard Kemmerer Keynote icsm11Richard Kemmerer Keynote icsm11
Richard Kemmerer Keynote icsm11
 
Lionel Briand ICSM 2011 Keynote
Lionel Briand ICSM 2011 KeynoteLionel Briand ICSM 2011 Keynote
Lionel Briand ICSM 2011 Keynote
 
Metrics - Using Source Code Metrics to Predict Change-Prone Java Interfaces
Metrics - Using Source Code Metrics to Predict Change-Prone Java InterfacesMetrics - Using Source Code Metrics to Predict Change-Prone Java Interfaces
Metrics - Using Source Code Metrics to Predict Change-Prone Java Interfaces
 
Traceability - Structural Conformance Checking with Design Tests: An Evaluati...
Traceability - Structural Conformance Checking with Design Tests: An Evaluati...Traceability - Structural Conformance Checking with Design Tests: An Evaluati...
Traceability - Structural Conformance Checking with Design Tests: An Evaluati...
 
ICSM'01 Most Influential Paper - Rainer Koschke
ICSM'01 Most Influential Paper - Rainer KoschkeICSM'01 Most Influential Paper - Rainer Koschke
ICSM'01 Most Influential Paper - Rainer Koschke
 
Impact analysis - A Seismology-inspired Approach to Study Change Propagation
Impact analysis - A Seismology-inspired Approach to Study Change PropagationImpact analysis - A Seismology-inspired Approach to Study Change Propagation
Impact analysis - A Seismology-inspired Approach to Study Change Propagation
 
ERA - Clustering and Recommending Collections of Code Relevant to Task
ERA - Clustering and Recommending Collections of Code Relevant to TaskERA - Clustering and Recommending Collections of Code Relevant to Task
ERA - Clustering and Recommending Collections of Code Relevant to Task
 
Postdoc symposium - A Logic Meta-Programming Foundation for Example-Driven Pa...
Postdoc symposium - A Logic Meta-Programming Foundation for Example-Driven Pa...Postdoc symposium - A Logic Meta-Programming Foundation for Example-Driven Pa...
Postdoc symposium - A Logic Meta-Programming Foundation for Example-Driven Pa...
 
Components - Graph Based Detection of Library API Limitations
Components - Graph Based Detection of Library API LimitationsComponents - Graph Based Detection of Library API Limitations
Components - Graph Based Detection of Library API Limitations
 
Faults and Regression testing - Localizing Failure-Inducing Program Edits Bas...
Faults and Regression testing - Localizing Failure-Inducing Program Edits Bas...Faults and Regression testing - Localizing Failure-Inducing Program Edits Bas...
Faults and Regression testing - Localizing Failure-Inducing Program Edits Bas...
 
Natural Language Analysis - Expanding Identifiers to Normalize Source Code Vo...
Natural Language Analysis - Expanding Identifiers to Normalize Source Code Vo...Natural Language Analysis - Expanding Identifiers to Normalize Source Code Vo...
Natural Language Analysis - Expanding Identifiers to Normalize Source Code Vo...
 

Último

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Principled Technologies
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024SynarionITSolutions
 

Último (20)

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 

Migration and Refactoring - Identifying Overly Strong Conditions in Refactoring Implementations

  • 1. Identifying overly strong conditions in refactoring implementations Gustavo Soares Melina Mongiovi Rohit Gheyi gsoares@dsc.ufcg.edu.br Federal University of Campina Grande terça-feira, 11 de outubro de 2011
  • 2. Employee ... Salesman Engineer ... ... name name Duplicated code 2 terça-feira, 11 de outubro de 2011
  • 3. Pull Up Field Refactoring Refactoring Employee engines Employee ... ... name Salesman Engineer ... ... Salesman Engineer name name ... ... Precondition The name field is not declared in class Employee 3 terça-feira, 11 de outubro de 2011
  • 4. It’s difficult to specify and implement preconditions preconditions 4 terça-feira, 11 de outubro de 2011
  • 5. Problem Overly  strong  condi0ons prevent  safe   transforma+ons Implemented preconditions Overly  weak condi0ons  allow unsafe  transforma+ons 5 terça-feira, 11 de outubro de 2011
  • 6. Motivating example A JRRT GetF() cannot access B variable f Pull up field private int f int getF() : f 6 terça-feira, 11 de outubro de 2011
  • 7. A Overly strong JRRT GetF() cannot access B variable f Pull up field private int f int getF() : f A A protected int f B B Pull up field private int f int getF() : f int getF() : f 7 terça-feira, 11 de outubro de 2011
  • 8. Identifying overly strong conditions An evaluation on 3 refactoring engines JRRT 8 terça-feira, 11 de outubro de 2011
  • 9. Testing input expected output 9 terça-feira, 11 de outubro de 2011
  • 10. Testing input engine expected output output Overly strong 10 terça-feira, 11 de outubro de 2011
  • 11. Exhaustively generating programs input Overly Strong Differential testing conditions Overly Strong Condition 11 terça-feira, 11 de outubro de 2011
  • 12. 2 Class, 2 Method, 2 Field One subclass declaring a field 12 terça-feira, 11 de outubro de 2011
  • 13. 2 Class, 2 Method, 2 Field One subclass declaring a field Java Meta model Alloy Solutions Java programs public class Class0 { public int method2(){ { { public class Class0 public class Class0 public int method2(){ return 10; public int method2(){ } return 10; return 10; } }} } class Class1 extends Class0 { } class Class1 extends Class0 { public int method1(){ Class0 { class Class1 extends public int method1(){ return 20; method1(){ public int } return 20; } return 20; public int method2(){ } public int method2(){ super.k(); method2(){ public int } super.k(); super.k(); } }} } } 13 terça-feira, 11 de outubro de 2011
  • 14. Exhaustively generating programs input expected output Differential testing Overly Strong Condition 14 terça-feira, 11 de outubro de 2011
  • 15. B.getF A A protected int f B B 0/4 0/4 private int f int getF() : f int getF() : f 4 No behavioral change was found 15 terça-feira, 11 de outubro de 2011
  • 16. Classifying overly strong preconditions Technique Differential testing 16 terça-feira, 11 de outubro de 2011 SPEC
  • 17. Classifying overly strong conditions A.test  cannot  access  method  A.k OTC B.m  cannot  access  method  B.n cannot  access  method C.test  cannot  access  method  C.k 17 terça-feira, 11 de outubro de 2011
  • 18. Evaluation 18 terça-feira, 11 de outubro de 2011
  • 19. Up to 10 refactorings Refactoring Eclipse JRRT NetBeans Rename Class X X X Rename Method X X X Rename Field X X X Push Down Method X X X Push Down Field X X X Pull Up Method X X X Pull Up Field X X X Encapsulate Field X X Move Method X X Add Parameter X X 2 Packages, 3 classes, 4 methods, 2 fields 19 terça-feira, 11 de outubro de 2011
  • 20. Results Rejected Beh. Pres. Overly Strong Condition Refactoring Program Ecl JRRT NetB Ecl JRRT NetB Rename Class 4660 446 0 0 2 0 0 Rename Method 4752 4802 419 0 4 1 0 Rename Field 3168 200 0 0 2 0 0 Push Down Method 9366 59 40 0 1 1 0 Push Down Field 4800 0 0 0 0 0 0 Pull Up Method 10322 251 398 0 2 2 0 Pull Up Field 4320 744 584 0 1 1 0 Encapsulate Field 900 176 1536 - 1 1 - Move Method 3002 367 135 - 2 1 - Add Parameter 4279 79 0 - 2 0 - Total 42774 7124 3112 0 17 7 0 20 terça-feira, 11 de outubro de 2011
  • 21. JRRT feedback Refactoring Strong conditions Rename Method overriding  has  changed Push Down Method cannot  access  method method  is  used Pull Up Method cannot  access  method Pull Up Field cannot  access  variable   Encapsulate Field cannot  insert  method  here Move Method cannot  inline  ambiguous  method  call 21 terça-feira, 11 de outubro de 2011
  • 22. JRRT feedback Refactoring Strong conditions Cause Rename Method overriding  has  changed precondi+on Push Down Method cannot  access  method incorrect  analysis method  is  used incorrect  analysis Pull Up Method cannot  access  method incorrect  analysis Pull Up Field cannot  access  variable   feature  not  implemented Encapsulate Field cannot  insert  method  here feature  not  implemented Move Method cannot  inline  ambiguous  method  call incorrect  analysis 22 terça-feira, 11 de outubro de 2011
  • 23. Conclusions Differential Testing + Implemented preconditions overly strong conditions + overly weak conditions 23 terça-feira, 11 de outubro de 2011
  • 24. Identifying overly strong conditions in refactoring implementations Gustavo Soares Melina Mongiovi Rohit Gheyi gsoares@dsc.ufcg.edu.br Federal University of Campina Grande 24 terça-feira, 11 de outubro de 2011