SlideShare ist ein Scribd-Unternehmen logo
1 von 35
Downloaden Sie, um offline zu lesen
N. Anquetil, M. Campero, S. Ducasse, J.P. Sandoval and P. Tesone
Transformation-based
Refactorings: a First Analysis
International Workshop on Smalltalk Technologies
• Vocabulary
• About the need of transformations
• Research questions
• Why RB engine?
• Analyses and results
Outline
• Refactoring: behavior preserving modi
fi
cation of the source
code.
• Transformation: behavior agnostic modi
fi
cation of the source
code.
• Pre-condition: a condition to hold before applying a refactoring
• Atomic refactoring: A refactoring that is not implemented using
some other refactorings
• Composite refactoring: Not Atomic.
• Elementary operation: A local modi
fi
cation of a program
Vocabulary
• Vocabulary
• About the need of transformations
• Research questions
• Why RB engine?
• Analyses and results
Outline
foo
self x
x
doing something
y
doing something else
bar
t x
Replace Call x by y
foo
self y
x
doing something
y
doing something else
bar
t y
This is not a refactoring because there is no warrantee that after the
application behavior stays the same
Replace Call Analysis
• Cannot easily be expressed with Rename Method Refactoring
• Now the implementation is close to Rename Method
• Look for all the senders
• Replace all the senders with the target method
Replace Call Analysis
• Developers are often left alone and do it manually
• There is a need for transformations as well as refactorings
Need for transformation too
• Could both refactorings and transformations share their code
modi
fi
cation logic?
• Could we decouple code transformations from refactorings to be
able to reuse them when behavior preservation is not a concern?
• Could we compose refactorings from such code
transformations?
Goal of the study
• Should we turn elementary operations into transformations?
• At which cost complex refactorings be expressed out of simpler
ones?
Correlated questions
• An analysis of the original implementation of Refactorings.
• The identi
fi
cation of di
ff
erent kinds of pre-conditions
• Understanding program modi
fi
cation API
• Identify atomic refactorings
• The identi
fi
cation of missed reuse opportunities in current
refactorings implementation
• Path for the real work
Contributions
• Seminal work
• Documented in PhD of D. Roberts
• Available and fully working
• Nice architecture (compared to mainstream engines)
• preview
• support o
ff
line code
Why RB engine?
Refactorings
RBMethod
RBNamespace
RBEntity
RBAbstractClass
RBPackage
RBMetaclass
RBClass
Changes
AST
ParseTreeRewriter
Condition
Program Model
• A refactoring reason on a program model
• Check preconditions on such a program model
• Produces changes that can be previewed
• Then actual modi
fi
cations are done
The architectural elements
Applying a refactoring
Refactorings
RBMethod
RBNamespace
RBEntity
RBAbstractClass
RBPackage
RBMetaclass
RBClass
Changes
AST
ParseTreeRewriter
Condition
Program Model
• Vocabulary
• About the need of transformations
• Research questions
• Why RB engine?
• Analyses and results
Outline
• None
• Applicability check
• Break check
• Complex ones
4 Families
Precondition Analysis
Looks like there were added by developers not following the design
Should really be revisited
Precondition: None
Precondition: None
Veri
fi
es that the program elements are available
Precondition: Applicability
RBCreateAccessorsForVariableRefactoring >> preconditions
^ classVariable
ifTrue: [ RBCondition de
fi
nesClassVariable: variableName
asSymbol in: class ]
ifFalse: [ RBCondition de
fi
nesInstanceVariable: variableName in:
class ]
Precondition: Applicability
Precondition: Applicability
• None
• Applicability check
• Break check
• Complex ones
Precondition: Break check
• None
• Applicability check
• Break check
• Complex ones
Precondition: Break check
• Veri
fi
es if the operation is done whether the system would be
broken
Precondition: Break check
RBRemoveClass >> preconditions
^ classNames
inject: self emptyCondition
into: [ :sum :each | | aClassOrTrait |
aClassOrTrait := self model classNamed: each asSymbol.
aClassOrTrait ifNil: [
self refactoringFailure: ’No such class or trait’ ].
sum & ((self preconditionIsNotMetaclass: aClassOrTrait)
& (self preconditionHasNoReferences: each)
& (self preconditionEmptyOrHasNoSubclasses: aClassOrTrait)
& (self preconditionHasNoUsers: aClassOrTrait)) ]
Precondition: Break check
Precondition: Break check
• Facing real code some things are not like in the books!
• To be cleaned up!
Precondition: Complex
RBPullUpMethod >> preconditions
self requestSuperClass.
^(selectors inject: (RBCondition hasSuperclass: class) into: [:cond :each | cond & (RBCondition de
fi
nesSelector:
each in: class)]) & (RBCondition withBlock: [self checkInstVars.
self checkClassVars.
self checkSuperclass.
self checkSuperMessages. true])
RBPullUpMethod >> checkInstVarsFor: aSelector
class instanceVariableNames do: [:each |
((class whichSelectorsReferToInstanceVariable: each) includes: aSelector) ifTrue: [ (self con
fi
rm: (’<1p> refers
to #<2s> which is de
fi
ned in <3p>. Do you want push up variable #<2s> also ?’ expandMacrosWith: aSelector with:
each with: class))
ifTrue: [ self pushUpVariable: each ]
ifFalse: [ self refactoringError: ’You are about to push your method without the instance variable it uses.
It will bring the system is an inconsistent state. But this may be what you want. So do you want to push up
anyway?’ ] ]]
RBPullUpMethod >> pushUpVariable: aVariable
| refactoring |
refactoring := RBPullUpInstanceVariableRefactoring model: self model variable: aVariable class:
targetSuperclass.
self performCompositeRefactoring: refactoring.
Precondition: Complex
• Transformations can have preconditions too!
Contrary to common beliefs
• What is basically the API that is used to perform changes?
• Could such API turned into
fi
rst class transformation?
Study the API of Program Model
Study the API of Program Model
• Analysed refactorings to identify atomic ones
• And also which ones are modifying the program model
Atomic refactorings and operations
• identify atomic
Atomic refactorings and operations
• Studied the refactorings that directly use the program API
elements
• They could be turned into composite refactorings
• Could the program API elements be turned into
fi
rst class
transformations?
Atomic refactorings and operations
Potential reuse
• Transformations can have preconditions too!
• Interaction should be removed from refactorings
• Identify Atomic refactorings
• Identify potential reuse in implicit refactoring
• Next step is to try to reify transformations and use them
Conclusion

Weitere ähnliche Inhalte

Ähnlich wie Transformation-based Refactorings: a First Analysis

Refactoring Legacy Web Forms for Test Automation
Refactoring Legacy Web Forms for Test AutomationRefactoring Legacy Web Forms for Test Automation
Refactoring Legacy Web Forms for Test AutomationStephen Fuqua
 
walkmod - JUG talk
walkmod - JUG talkwalkmod - JUG talk
walkmod - JUG talkwalkmod
 
Get Testing with tSQLt - SQL In The City Workshop 2014
Get Testing with tSQLt - SQL In The City Workshop 2014Get Testing with tSQLt - SQL In The City Workshop 2014
Get Testing with tSQLt - SQL In The City Workshop 2014Red Gate Software
 
Model–driven system testing service oriented systems
Model–driven system testing service oriented systemsModel–driven system testing service oriented systems
Model–driven system testing service oriented systemsRifad Mohamed
 
2011-02-03 LA RubyConf Rails3 TDD Workshop
2011-02-03 LA RubyConf Rails3 TDD Workshop2011-02-03 LA RubyConf Rails3 TDD Workshop
2011-02-03 LA RubyConf Rails3 TDD WorkshopWolfram Arnold
 
Commonly used design patterns
Commonly used design patternsCommonly used design patterns
Commonly used design patternsMojammel Haque
 
Reflection in Pharo: Beyond Smalltak
Reflection in Pharo: Beyond SmalltakReflection in Pharo: Beyond Smalltak
Reflection in Pharo: Beyond SmalltakMarcus Denker
 
Reflection in Pharo5
Reflection in Pharo5Reflection in Pharo5
Reflection in Pharo5Marcus Denker
 
Behavioral Reflection in Pharo
Behavioral Reflection in PharoBehavioral Reflection in Pharo
Behavioral Reflection in PharoESUG
 
Refactoring Applications using SOLID Principles
Refactoring Applications using SOLID PrinciplesRefactoring Applications using SOLID Principles
Refactoring Applications using SOLID PrinciplesSteven Smith
 
Системный взгляд на параллельный запуск Selenium тестов
Системный взгляд на параллельный запуск Selenium тестовСистемный взгляд на параллельный запуск Selenium тестов
Системный взгляд на параллельный запуск Selenium тестовCOMAQA.BY
 
#Pharo Days 2016 Reflectivity
#Pharo Days 2016 Reflectivity#Pharo Days 2016 Reflectivity
#Pharo Days 2016 ReflectivityPhilippe Back
 

Ähnlich wie Transformation-based Refactorings: a First Analysis (20)

Refactoring Legacy Web Forms for Test Automation
Refactoring Legacy Web Forms for Test AutomationRefactoring Legacy Web Forms for Test Automation
Refactoring Legacy Web Forms for Test Automation
 
walkmod - JUG talk
walkmod - JUG talkwalkmod - JUG talk
walkmod - JUG talk
 
Basic RSpec 2
Basic RSpec 2Basic RSpec 2
Basic RSpec 2
 
Design p atterns
Design p atternsDesign p atterns
Design p atterns
 
Variables in Pharo
Variables in PharoVariables in Pharo
Variables in Pharo
 
Get Testing with tSQLt - SQL In The City Workshop 2014
Get Testing with tSQLt - SQL In The City Workshop 2014Get Testing with tSQLt - SQL In The City Workshop 2014
Get Testing with tSQLt - SQL In The City Workshop 2014
 
Model–driven system testing service oriented systems
Model–driven system testing service oriented systemsModel–driven system testing service oriented systems
Model–driven system testing service oriented systems
 
Aspnet mvc
Aspnet mvcAspnet mvc
Aspnet mvc
 
2011-02-03 LA RubyConf Rails3 TDD Workshop
2011-02-03 LA RubyConf Rails3 TDD Workshop2011-02-03 LA RubyConf Rails3 TDD Workshop
2011-02-03 LA RubyConf Rails3 TDD Workshop
 
Angular VS FORWARD
Angular VS FORWARDAngular VS FORWARD
Angular VS FORWARD
 
Angular vs FORWARD
Angular vs FORWARDAngular vs FORWARD
Angular vs FORWARD
 
Commonly used design patterns
Commonly used design patternsCommonly used design patterns
Commonly used design patterns
 
Reflection in Pharo: Beyond Smalltak
Reflection in Pharo: Beyond SmalltakReflection in Pharo: Beyond Smalltak
Reflection in Pharo: Beyond Smalltak
 
Reflection in Pharo5
Reflection in Pharo5Reflection in Pharo5
Reflection in Pharo5
 
Behavioral Reflection in Pharo
Behavioral Reflection in PharoBehavioral Reflection in Pharo
Behavioral Reflection in Pharo
 
Refactoring Applications using SOLID Principles
Refactoring Applications using SOLID PrinciplesRefactoring Applications using SOLID Principles
Refactoring Applications using SOLID Principles
 
Refactoring
RefactoringRefactoring
Refactoring
 
Системный взгляд на параллельный запуск Selenium тестов
Системный взгляд на параллельный запуск Selenium тестовСистемный взгляд на параллельный запуск Selenium тестов
Системный взгляд на параллельный запуск Selenium тестов
 
#Pharo Days 2016 Reflectivity
#Pharo Days 2016 Reflectivity#Pharo Days 2016 Reflectivity
#Pharo Days 2016 Reflectivity
 
Man.ppt
Man.pptMan.ppt
Man.ppt
 

Mehr von ESUG

Workshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingWorkshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingESUG
 
Technical documentation support in Pharo
Technical documentation support in PharoTechnical documentation support in Pharo
Technical documentation support in PharoESUG
 
The Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapThe Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapESUG
 
Sequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in PharoSequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in PharoESUG
 
Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...ESUG
 
Analyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsAnalyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsESUG
 
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6ESUG
 
A Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test GenerationA Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test GenerationESUG
 
Creating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingCreating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingESUG
 
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesThreaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesESUG
 
Exploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience ReportExploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience ReportESUG
 
Pharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIsPharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIsESUG
 
Garbage Collector Tuning
Garbage Collector TuningGarbage Collector Tuning
Garbage Collector TuningESUG
 
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseImproving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseESUG
 
Pharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FuturePharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FutureESUG
 
thisContext in the Debugger
thisContext in the DebuggerthisContext in the Debugger
thisContext in the DebuggerESUG
 
Websockets for Fencing Score
Websockets for Fencing ScoreWebsockets for Fencing Score
Websockets for Fencing ScoreESUG
 
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScriptShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScriptESUG
 
Advanced Object- Oriented Design Mooc
Advanced Object- Oriented Design MoocAdvanced Object- Oriented Design Mooc
Advanced Object- Oriented Design MoocESUG
 
A New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and TransformationsA New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and TransformationsESUG
 

Mehr von ESUG (20)

Workshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingWorkshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programming
 
Technical documentation support in Pharo
Technical documentation support in PharoTechnical documentation support in Pharo
Technical documentation support in Pharo
 
The Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapThe Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and Roadmap
 
Sequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in PharoSequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in Pharo
 
Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...
 
Analyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsAnalyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early results
 
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
 
A Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test GenerationA Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test Generation
 
Creating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingCreating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic Programming
 
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesThreaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
 
Exploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience ReportExploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience Report
 
Pharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIsPharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIs
 
Garbage Collector Tuning
Garbage Collector TuningGarbage Collector Tuning
Garbage Collector Tuning
 
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseImproving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
 
Pharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FuturePharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and Future
 
thisContext in the Debugger
thisContext in the DebuggerthisContext in the Debugger
thisContext in the Debugger
 
Websockets for Fencing Score
Websockets for Fencing ScoreWebsockets for Fencing Score
Websockets for Fencing Score
 
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScriptShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
 
Advanced Object- Oriented Design Mooc
Advanced Object- Oriented Design MoocAdvanced Object- Oriented Design Mooc
Advanced Object- Oriented Design Mooc
 
A New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and TransformationsA New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and Transformations
 

Kürzlich hochgeladen

Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceanilsa9823
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 

Kürzlich hochgeladen (20)

Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 

Transformation-based Refactorings: a First Analysis

  • 1. N. Anquetil, M. Campero, S. Ducasse, J.P. Sandoval and P. Tesone Transformation-based Refactorings: a First Analysis International Workshop on Smalltalk Technologies
  • 2. • Vocabulary • About the need of transformations • Research questions • Why RB engine? • Analyses and results Outline
  • 3. • Refactoring: behavior preserving modi fi cation of the source code. • Transformation: behavior agnostic modi fi cation of the source code. • Pre-condition: a condition to hold before applying a refactoring • Atomic refactoring: A refactoring that is not implemented using some other refactorings • Composite refactoring: Not Atomic. • Elementary operation: A local modi fi cation of a program Vocabulary
  • 4. • Vocabulary • About the need of transformations • Research questions • Why RB engine? • Analyses and results Outline
  • 5. foo self x x doing something y doing something else bar t x Replace Call x by y foo self y x doing something y doing something else bar t y
  • 6. This is not a refactoring because there is no warrantee that after the application behavior stays the same Replace Call Analysis
  • 7. • Cannot easily be expressed with Rename Method Refactoring • Now the implementation is close to Rename Method • Look for all the senders • Replace all the senders with the target method Replace Call Analysis
  • 8. • Developers are often left alone and do it manually • There is a need for transformations as well as refactorings Need for transformation too
  • 9. • Could both refactorings and transformations share their code modi fi cation logic? • Could we decouple code transformations from refactorings to be able to reuse them when behavior preservation is not a concern? • Could we compose refactorings from such code transformations? Goal of the study
  • 10. • Should we turn elementary operations into transformations? • At which cost complex refactorings be expressed out of simpler ones? Correlated questions
  • 11. • An analysis of the original implementation of Refactorings. • The identi fi cation of di ff erent kinds of pre-conditions • Understanding program modi fi cation API • Identify atomic refactorings • The identi fi cation of missed reuse opportunities in current refactorings implementation • Path for the real work Contributions
  • 12. • Seminal work • Documented in PhD of D. Roberts • Available and fully working • Nice architecture (compared to mainstream engines) • preview • support o ff line code Why RB engine? Refactorings RBMethod RBNamespace RBEntity RBAbstractClass RBPackage RBMetaclass RBClass Changes AST ParseTreeRewriter Condition Program Model
  • 13. • A refactoring reason on a program model • Check preconditions on such a program model • Produces changes that can be previewed • Then actual modi fi cations are done The architectural elements Applying a refactoring Refactorings RBMethod RBNamespace RBEntity RBAbstractClass RBPackage RBMetaclass RBClass Changes AST ParseTreeRewriter Condition Program Model
  • 14. • Vocabulary • About the need of transformations • Research questions • Why RB engine? • Analyses and results Outline
  • 15. • None • Applicability check • Break check • Complex ones 4 Families Precondition Analysis
  • 16. Looks like there were added by developers not following the design Should really be revisited Precondition: None
  • 18. Veri fi es that the program elements are available Precondition: Applicability
  • 19. RBCreateAccessorsForVariableRefactoring >> preconditions ^ classVariable ifTrue: [ RBCondition de fi nesClassVariable: variableName asSymbol in: class ] ifFalse: [ RBCondition de fi nesInstanceVariable: variableName in: class ] Precondition: Applicability
  • 21. • None • Applicability check • Break check • Complex ones Precondition: Break check
  • 22. • None • Applicability check • Break check • Complex ones Precondition: Break check
  • 23. • Veri fi es if the operation is done whether the system would be broken Precondition: Break check
  • 24. RBRemoveClass >> preconditions ^ classNames inject: self emptyCondition into: [ :sum :each | | aClassOrTrait | aClassOrTrait := self model classNamed: each asSymbol. aClassOrTrait ifNil: [ self refactoringFailure: ’No such class or trait’ ]. sum & ((self preconditionIsNotMetaclass: aClassOrTrait) & (self preconditionHasNoReferences: each) & (self preconditionEmptyOrHasNoSubclasses: aClassOrTrait) & (self preconditionHasNoUsers: aClassOrTrait)) ] Precondition: Break check
  • 26. • Facing real code some things are not like in the books! • To be cleaned up! Precondition: Complex
  • 27. RBPullUpMethod >> preconditions self requestSuperClass. ^(selectors inject: (RBCondition hasSuperclass: class) into: [:cond :each | cond & (RBCondition de fi nesSelector: each in: class)]) & (RBCondition withBlock: [self checkInstVars. self checkClassVars. self checkSuperclass. self checkSuperMessages. true]) RBPullUpMethod >> checkInstVarsFor: aSelector class instanceVariableNames do: [:each | ((class whichSelectorsReferToInstanceVariable: each) includes: aSelector) ifTrue: [ (self con fi rm: (’<1p> refers to #<2s> which is de fi ned in <3p>. Do you want push up variable #<2s> also ?’ expandMacrosWith: aSelector with: each with: class)) ifTrue: [ self pushUpVariable: each ] ifFalse: [ self refactoringError: ’You are about to push your method without the instance variable it uses. It will bring the system is an inconsistent state. But this may be what you want. So do you want to push up anyway?’ ] ]] RBPullUpMethod >> pushUpVariable: aVariable | refactoring | refactoring := RBPullUpInstanceVariableRefactoring model: self model variable: aVariable class: targetSuperclass. self performCompositeRefactoring: refactoring. Precondition: Complex
  • 28. • Transformations can have preconditions too! Contrary to common beliefs
  • 29. • What is basically the API that is used to perform changes? • Could such API turned into fi rst class transformation? Study the API of Program Model
  • 30. Study the API of Program Model
  • 31. • Analysed refactorings to identify atomic ones • And also which ones are modifying the program model Atomic refactorings and operations
  • 32. • identify atomic Atomic refactorings and operations
  • 33. • Studied the refactorings that directly use the program API elements • They could be turned into composite refactorings • Could the program API elements be turned into fi rst class transformations? Atomic refactorings and operations
  • 35. • Transformations can have preconditions too! • Interaction should be removed from refactorings • Identify Atomic refactorings • Identify potential reuse in implicit refactoring • Next step is to try to reify transformations and use them Conclusion