avoid dialog boxes while refactoring

 I was reading a post about Visual Studio refactoring support in the next version, and I noticed that it described the process of refactoring the order of parameters for a function as something like this:

1.      click on a function name

2.      select refactor->reorder parameters from the menu

3.      adjust the ordering on a dialog that pops up

4.      click OK to apply the changes everywhere

This seems unnecessarily cumbersome to me.  The same post talks about the existence of “smart tags” in the UI.  You should be able to grab the smart tag for a particular parameter, and just drag that parameter into a different position in the list.  This should do the full refactoring, including fixing up all the calls to that function.  You should be able to grab the smart tag and “throw it away” too – just like you can do to column headers in Outlook.  That would do a “remove parameter” refactoring.

Comments (3)

  1. Anonymous says:

    Great idea 🙂

    I proposed something similar given access to avalon type functionality. As you dragged a parameter around you’d see the other paramaters smoothly reorder themselves (a la the dock in OSX), making it completley intuitive what was happening.

    One issue is that people might want to preview the changes before they are made. This dialog allows for either behavior.

    Also, there are risks with a drag/drop model where someone might accidentally reorder without meaning to. This was similar to issues with the windows task bar where you wanted to click on a task but errantly ended up draggin the whole task bar to another edge of the screen. It was an incredibly disorienting experience and one of the reasons that the "lock taskbar" option becamse available.

  2. Anonymous says:

    Well the solution then is to let the user decide. Put the option in the IDE settings, and turn it off by default. Those that want it can enable it. It’s a terrific idea.