Eclipse: Most useful refactorings

Adrian picture Adrian · Nov 26, 2009 · Viewed 35.2k times · Source

Every now and again, I make use of the Eclipse refactoring feature. Some techniques are more obvious then others and some I never tried.

What refactoring is most useful for you and why?

Note: I find this presentation very useful, perhaps because it is example driven therefore easy to understand:

"Refactoring for everyone - How and why to use Eclipse's automated refactoring features"

Edit: This article is useful as well (Thanks jitter)

Explore refactoring functions in Eclipse JDT

Answer

zvikico picture zvikico · Dec 7, 2009

It is an interesting question. I know what works for me and it is interesting to see what others use.

I decided to take a more scientific approach to determine the most commonly used refactoring commands. Eclipse has a Usage Data Collector (UDC) feature built in. The data is publicly available. I took the data and extracted the following graph which shows the most commonly used editing commands (without navigation commands).

alt text http://img.skitch.com/20091207-bmcng36rjy837sqmcx58b85age.gif

However, I am a strong believer in "Save Actions" for formatting and organizing imports (read my article about it), so I wouldn't count those. I would also remove the commenting actions. The picture looks like this: alt text http://img.skitch.com/20091207-ieas1mk5114fwitucqkqxyw6t.gif