Wednesday Nov 20, 2013

Floss Refactoring in NetBeans IDE

Ralph, the NetBeans refactoring guru, tells me to press "Ctrl-R" below, over the variable "x". Then I see (a very nice small unobtrusive) dialog that shows the label "Apply Rename on Comments", with (even more unobtrusively) "Press 'Ctrl+R' Again for Refactoring Dialog":

Next, when I press Ctrl+R again, I see the Refactoring dialog, in the place and with the functionality that I am used to from other refactoring actions in NetBeans IDE:

So, then, I ask Ralph: "What's the big deal here?"

He says: "Well, this is the first step to fully supporting 'floss refactoring', which means being able to refactor continuously. We do not want to be obstructed by various dialogs, but we want to have the full refactoring engine at our finger tips."

What's the next step, then? "To add full support for all the other options, e.g., renaming getters and setters and copying the same principle to the other refactorings. Extract method will directly show you the extracted method and will  let you configure the new method name in the editor, instead of in a dialog."

Is this all about not needing to open dialogs and, instead, refactoring in-line, within the code? "Yes, this is one of the things we need to support floss refactoring."

OK, so what else do we need? "Drag and drop refactoring..."

So, what's "floss refactoring"?

When we talk about refactoring tactics, we are referring to the choices that you make about how to mix refactoring with your other programing tasks, and how frequently you choose to refactor. To describe the tactics, we use a dental metaphor. We call one tactic "floss refactoring"; this is characterized by frequent refactoring, intermingled with other kinds of program changes. In contrast, we call the other tactic "root canal refactoring". This is characterized by infrequent, protracted periods of refactoring, during which programmers perform few if any other kinds of program changes. You perform floss refactoring to maintain healthy code, and you perform root canal refactoring to correct unhealthy code. Further details:

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.


« November 2013 »