3 ms·
In 15 years of coding, I've need to do that exactly zero times. Is this really something people are doing?
by erichocean 13y ago
In 15 years of coding, I've need to do that exactly zero times.
Is this really something people are doing?
- kasey_junk 13y agoIt's an extremely common refactoring in modern Java/C# IDE's. Swapping arguments isn't necessarily a big deal (but being able to do it safely and automatically means that there is also no cost). A bigger one is adding/deleting parameters or renaming methods.
- fit2rule 13y agoI don't understand why it would be necessary to refactor the argument order for methods that are extensively used. Can you provide a productive example for when this might be an appropriate action for a developer to take - I'm having difficulty understanding why on Earth this would be necessary, but I'd be happy to learn ..
- kasey_junk 13y ago"Necessary" might be a hard barrier to get over, but I can think of times when it might be nice. For instance in C# optional parameters must be at the end of the parameter list (that is all required parameters must come before any optional ones). So for our highly used method we realize that there is actually a reasonable default for the first parameter (maybe because we notice tons of usages of that value). In order to change this from a required to an optional field, we must move it to the back of the list. Without an automated and safe way to do this, I'm unlikely to make that refactoring, leaving us with a code base that is worse than it could be. Again, is it necessary? No, but if it is trivial my code will get better, if it isn't my code will stay worse.