Dave Brookes wrote:
In the age of universal provision of find/replace, in even basic programmer editors, the overhead of changing all occurrences is pretty low. I recall a similar discussion on another board, in this case more specifically about refactoring and the potential benefit of a "refactoring browser" which understands the structure of code and allows most refactorings (such as changing the name of a method) to be "one-click" operations. One correspondent asked essentially the same question as above.
The answer was pretty simple. Would you really trust a global find/replace to change, for example "iCount" to "lCount" without accidentally changing other matching
patterns such as "iCount" in another scope, "iCounter", or even "DeliCounter" at the same time. To be 100% confident of automatic find/replace, all your names have to be entirely separate, which seems a mad overhead to require.
The other problem is that for method parameters and return types only the
type is known, not the names of variables in other scopes which use it. And in many cases the parameters aren't even variables, but expressions or casts. Can you provide a find/replace pattern which would successfully transform even the following simple case from using ints to floats:
For me the bottom line is that any form of markup which does not directly reflect the
problem domain is a candidate for removal, and may just make more work for a maintainer.
I much prefer to refactor code into small enough chunks so that the definition of any local variable is only an eye-flick away, and name interface methods and instance variables by domain function.