Better and more refactorings for
Pharo

By: Evelyn Cusi Lopez

Get Started

Initial proposal

In the initial proposal , the main goal was:

“Improve Pharo's refactoring support”

and to reach this goal I had planned to make the following tasks:

  • Add three missing refactoring options: inline method, inline variable and find and replace duplicate code.
  • Improve usability of refactoring tools by adding: preview dialogs and shortcuts for a number of refactoring options, such as: extract method, extract temp, inline method.
  • Improve the extract method refactoring option by checking for duplicated instances of the refactored code and letting the user specify arguments.

Changes to the Proposal



However, some of the missing refactorings that I proposed
had already been implemented in Pharo, specifically:
Inline method and Inline variable.

So to replace those tasks I fixed some issues reported in Enjoliveur project
and added documentation to make the existing refactorings more known
by the community.

Therefore, after these changes, the project's development can be divided into three parts:

  1. Fix issues
  2. Improve existing refactorings
  3. Add new refactorings


Contributions

In this section, I will describe the contributions made to Pharo during this summer.

Fix issues


1. Cleaning of tests and classes of the refactoring packages (Merged: #3409, #3427, #3687, #4361)

2. Avoid that refactoring tests raise a pop up (Merged: #4322)

3. Fix refactoring preview when the change is empty (Merged: #4256)

4. Move Abstract refactoring command to SystemCommands-VariableCommands package (Merged: #4328)

5. Add submenu, icons and shortcuts to commands (Merged: #4131, #4167)

Improve existing refactorings


1. New previews for Push up and Push down refactorings (Merged: #4132)

2. Add option to rename parameters when extract a method (Merged: #4168)

3. Delete warnings of references between classes that will be remove (Merged: #4295)

4. Find ocurrences when extract method (Under Review: #4430)

Add new refactorings


1. Replace one method call by another one (Merged: #4323)

2. Find and replace method (Under Review: #4430)

3. Remove method and the ones in subclasses (Under Review: #4427)

4. Undo refactoring (Under Review: #4426)

Conclusion

In this project, I have implemented new refactorings and improved some existing refactorings; however,
there is still a lot of work ahead to improve the refactoring tools that Pharo has.
During this summer, I have learned a lot about the inner workings of Pharo's refactoring, Calypso and Spec.
I have also improved considerably my knowledge of Pharo.

Acknowledgements

I would like to thank to my mentors, for guiding me in the execution of the project, providing feedback and reviewing the code.
I would also like to thank Cyril Ferlicot, Denis Kudriashov and Stéphane Ducasse, for helping with organizational aspects, and code reviewing.
Finally, I would like to thank the Pharo Consortium, the staff of GSoC, and Google, for this incredible experience that is GSoC.