Handwritten Text Recognition for manuscripts and early printed texts
A Scripting Environment for Refactoring Process Execution
1. A Scripting Environment
for Refactoring Process Execution
Lee Wei Mar (馬立偉), Kuo Chen Wu (吳國禎)
and Hewijin Christine Jiau (焦惠津)
Institute of Computer and Communication Engineering, NCKU
國立成功大學 電腦與通信工程研究所
Speaker: Lee Wei Mar (馬立偉)
Date: 07/08/2011
3. Introduction
• Refactoring: program transformation that alters software internal
structure without breaking its external behavior
• General refactoring process
Detection Proposal Transformation
Identify software
structural deficiencies
Propose refactoring plan to
alter structural deficiencies
Execute the
refactoring plan
• Different tools are developed for different stages of the refactoring process
3
4. Introduction (cont.)
• Refactoring process properties
– Varies in terms of detection criteria, execution style, and expected effect, etc.
– Requires to cascade different tools (session switches during execution)
– Contains repetitive works inside single refactoring process instances
– Shares similar work flow among different process instances
• This work proposes Refactoring Commando, a scripting environment for
assisting refactoring process execution
– Unified command line interface for refactoring tools cascading
– Programmable environment for batching repetitive works
– Preserving developed procedure for future re-use
4
7. Refactoring Commando: API
Category API Method Description
aProject.getType(name) Get all types defined in aProject as a list
Program Model Query aClass.methods() Get all methods defined in aClass as a list
aClass.getSuperTypes() Get super-types of aClass
aClass.atfd() Get an ATFD metrics abstraction of aClass
Metric-based
atfdMA.callees(m) Get a list of foreign fields called by method m
Bad Smell Detection
aMA.value() Get the metric value of metric abstraction aMA
Bad Smell Inspection MavisAdapter.viz(method) Open MAVIS visualization of the given method
Refactoring Plan Proposal Refactory.createMM() Create Move Method refactoring plan
plan.maChange () Preview overall metric abstraction changes of plan
Refactoring Preview
and Execution plan.execute() Execute the refactoring plan
7
8. Usage Scenario
• Context
– A developer would like to locate and remove Feature Envy in ProjectA
– He has prior experience on using Refactoring Commando to detect Feature Envy
• Scenario
1. Find Possible Feature Envy Methods (using pre-developed procedure)
2. Inspect Methods Using MAVIS
3. Construct Move Method Refactoring Plan
4. Preview Refactoring Effects
5. Preview Refactored Code
6. Execute the Refactoring Plan
8
9. Usage Scenario
(1) Find Possible Feature Envy Methods
Import and execute script file
Procedure for Feature Envy Detection
9
10. Usage Scenario
(2) Inspect Methods Using MAVIS
Inspect method code with MAVIS
Building.landArea() is envied to Land
10
11. Usage Scenario
(3) Construct Move Method Refactoring Plan
Move Method Building.landArea() to Land
11
14. Usage Scenario
(6) Execute the Refactoring Plan
plan.maChange()
plan.codeChange()
change
applied
plan.execute()
14
15. Conclusion
• Refactoring Commando has been proposed as a scripting environment
for refactoring process execution
• A set of APIs is provided in Refactoring Commando to support all stages of
a refactoring process
• An usage scenario is presented to demonstrate the usefulness of
Refactoring Commando
– Collaboration with other plugins for ensuring refactoring process integrity
– Batching repetitive refactoring works with programmable procedure
– Preservation of procedures for future re-use in similar refactoring tasks
15
16. Thank You
Lee Wei Mar (馬立偉)
lwmar@nature.ee.ncku.edu.tw
Database & Software Engineering Lab, NCKU
國立成功大學
資料庫暨軟體工程實驗室