What features are you looking for (or are using most) in refactoring tools?

I am familiar with the basics, such as the Extract Method. But that’s all I use. What is there? This may include refactoring features, as well as macros that you write yourself.

+4
source share
4 answers

From Resharper

  • Safe rename function.
  • Member / highlighting variables.
  • On-the-fly error detection
  • Import namespaces

It’s also a very good macro to use (it will also help you create your own)

Visual Studio Macro: Minimize Solution Explorer

A macro that destroys all tree nodes in the solution explorer ...

This is very useful in large solutions.

+3
source

I currently use IntelliJ IDEA, most often

  • Rename (it can also rename getters / setters and links in comments, literals, and even non-Java files such as Hibernate mapping files).
  • Enter variable / constant / field / parameter
  • Internal variable / constant / field
  • Retrieval method, of course (mother of all refactoring)
  • Change method signature (very useful)

And then there is much more that is needed less often, but when they are needed, they are badly needed:

  • Extract Interface / Superclass / Class
  • Move method / class

Although renaming looks somewhat trivial, it is still the most important. Finding good and best names for my program elements is an ongoing activity. Good names can significantly affect the readability of a program.

The OTOH refactoring archetype is the extraction method, because it is much more difficult to automate. There can be many pitfalls, such as a possible collision of names with the supertype method (or even worse: unintentionally overriding), input / output parameters, etc. Thus, it was a kind of threshold test for automatic refactoring tools for a long time, although, I believe that by now ordinary people are doing a good job of this.

+2
source

In addition to @astander's comments, I use Convert Local Variable to Field (and vice versa) with some frequency. And when I need it, Pull Up (i.e., Make a method in a subclass as a method over a superclass) REALLY nice to have.

+1
source

In IDEA, in addition to what Peter Torek mentioned, I use a lot:

  • Pull items up
  • Press the buttons down.
  • Secure removal

And some useful code generation (implementation method, override method, constructor creation).

0
source

Source: https://habr.com/ru/post/1301372/


All Articles