Cascading changes from a method rename - what do you think?
I'm working on an issue with the C# refactoring and wanted to get your opinion. One of the things we are delivering in VS 2005 is the ability to reliably rename methods, types etc.
We have a current issue where you can be in some code and you want to rename a method. The method is actually part of an interface definition (let's ignore the fact that we currently don't have a way to indicate that the method is part of an interface).
There are several ways to interpret renaming this method. Our current implementation does this:
- Changes the name of the method in the class that you are editing (this is where you kicked the rename off)
- We detect that the method is part of an interface declaration so we change the interface to match the new name.
- We then detect all other implementations of the interface and change the methods in those types to match the new name.
I'm a little concerned that this is a little too “easy” and may cause more changes than a developer was expecting. We have a number of ways to fix this (inform the user that this is happening, come up with a way of selectively choosing which replacements to make via the preview dialog) but I'm inclined to perhaps simply restrict this so that you can only rename an interface methods from the interface itself so it's a much more deliberate action.
We are still tossing this around but I'd love to get your feedback on what you would expect.