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

Advantages of Cargo Cloud Solutions.pptx
Advantages of Cargo Cloud Solutions.pptxAdvantages of Cargo Cloud Solutions.pptx
Advantages of Cargo Cloud Solutions.pptxRTS corp
 
eSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolseSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolsosttopstonverter
 
Business Analyzopedia - Your Pocket Gita for Business Analysis
Business Analyzopedia - Your Pocket Gita for Business AnalysisBusiness Analyzopedia - Your Pocket Gita for Business Analysis
Business Analyzopedia - Your Pocket Gita for Business AnalysisDEEPRAJ PATHAK
 
Zer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdfZer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdfmaor17
 
logical backup of Oracle Datapump-detailed.pptx
logical backup of Oracle Datapump-detailed.pptxlogical backup of Oracle Datapump-detailed.pptx
logical backup of Oracle Datapump-detailed.pptxRemote DBA Services
 
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jGraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jNeo4j
 
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics
 
SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?Alexandre Beguel
 
Key Steps in Agile Software Delivery Roadmap
Key Steps in Agile Software Delivery RoadmapKey Steps in Agile Software Delivery Roadmap
Key Steps in Agile Software Delivery RoadmapIshara Amarasekera
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slidesvaideheekore1
 
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...Bert Jan Schrijver
 
Transform your Corporate Strategy Office - Harness OnePlan’s Strategic Portfo...
Transform your Corporate Strategy Office - Harness OnePlan’s Strategic Portfo...Transform your Corporate Strategy Office - Harness OnePlan’s Strategic Portfo...
Transform your Corporate Strategy Office - Harness OnePlan’s Strategic Portfo...OnePlan Solutions
 
Revolutionize Your Video Editing with InVideo.io: A Comprehensive Review
Revolutionize Your Video Editing with InVideo.io: A Comprehensive ReviewRevolutionize Your Video Editing with InVideo.io: A Comprehensive Review
Revolutionize Your Video Editing with InVideo.io: A Comprehensive Reviewjw364beach
 
oracle 23c new features for developer and dba
oracle 23c new features for developer and dbaoracle 23c new features for developer and dba
oracle 23c new features for developer and dbaRemote DBA Services
 
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...OnePlan Solutions
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shardsChristopher Curtin
 
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdfSteve Caron
 
Effort Estimation Techniques used in Software Projects
Effort Estimation Techniques used in Software ProjectsEffort Estimation Techniques used in Software Projects
Effort Estimation Techniques used in Software ProjectsDEEPRAJ PATHAK
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesVictoriaMetrics
 
full course of software engineering mid term.pdf
full course of software engineering mid term.pdffull course of software engineering mid term.pdf
full course of software engineering mid term.pdfAbdul salam
 

Kürzlich hochgeladen (20)

Advantages of Cargo Cloud Solutions.pptx
Advantages of Cargo Cloud Solutions.pptxAdvantages of Cargo Cloud Solutions.pptx
Advantages of Cargo Cloud Solutions.pptx
 
eSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolseSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration tools
 
Business Analyzopedia - Your Pocket Gita for Business Analysis
Business Analyzopedia - Your Pocket Gita for Business AnalysisBusiness Analyzopedia - Your Pocket Gita for Business Analysis
Business Analyzopedia - Your Pocket Gita for Business Analysis
 
Zer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdfZer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdf
 
logical backup of Oracle Datapump-detailed.pptx
logical backup of Oracle Datapump-detailed.pptxlogical backup of Oracle Datapump-detailed.pptx
logical backup of Oracle Datapump-detailed.pptx
 
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jGraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
 
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
 
SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?
 
Key Steps in Agile Software Delivery Roadmap
Key Steps in Agile Software Delivery RoadmapKey Steps in Agile Software Delivery Roadmap
Key Steps in Agile Software Delivery Roadmap
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slides
 
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
 
Transform your Corporate Strategy Office - Harness OnePlan’s Strategic Portfo...
Transform your Corporate Strategy Office - Harness OnePlan’s Strategic Portfo...Transform your Corporate Strategy Office - Harness OnePlan’s Strategic Portfo...
Transform your Corporate Strategy Office - Harness OnePlan’s Strategic Portfo...
 
Revolutionize Your Video Editing with InVideo.io: A Comprehensive Review
Revolutionize Your Video Editing with InVideo.io: A Comprehensive ReviewRevolutionize Your Video Editing with InVideo.io: A Comprehensive Review
Revolutionize Your Video Editing with InVideo.io: A Comprehensive Review
 
oracle 23c new features for developer and dba
oracle 23c new features for developer and dbaoracle 23c new features for developer and dba
oracle 23c new features for developer and dba
 
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards
 
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf
 
Effort Estimation Techniques used in Software Projects
Effort Estimation Techniques used in Software ProjectsEffort Estimation Techniques used in Software Projects
Effort Estimation Techniques used in Software Projects
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 Updates
 
full course of software engineering mid term.pdf
full course of software engineering mid term.pdffull course of software engineering mid term.pdf
full course of software engineering mid term.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