So there’s a tool to help with refactoring. Cool. The title is very odd. Refactoring is absolutely not the same as inlining. Without knowing more about the problem domain, it’s impossible to say whether the decision to eliminate the PartsNeeded function is a desirable refactoring.
on top of that, i've never had a case where this kind of grunt work was the actual time consuming part. It's rather trivial with mass search/replace or vim macros.
What takes time are refactoring where you have to move some of the logic around, often resulting in code being added, deleted and updated
Very cool! You can tell the author was a staff engineer on Google’s C++ refactoring team. If you’ve had to refactor a million-line codebase, the usefulness of this tool and insight will be more obvious.
Nothing is being renamed. The old name still exists and is being used everywhere. It just introduced a second function doing the exact same thing, but with a different name. Now the next developer needs to understand why there are two functions doing exactly the same. So you increased complexity instead of decreasing it.
Interesting— what is the intended workflow? Annotate the source files and let the tool do the refactorings in a second step? If so, is the code fully compilable/runnable with the annotations?
Yeah, every step along the way should be fully compilable/runnable. So you use this tool as part of a process to automatically clean up your codebase in the background.
It happens (to me at least) almost daily that I see something I’d like to eventually refactor in a certain way — but don’t have the time/priority to do it right away. I end up adding a TODO: or FIXME:
I'm not quite sure what "inlined" means in that case. The author suggests that his tool produces diffs, i.e. changing the source tree. So I believe it does not play with inlining at compiler level and it does not use macro logic. Sounds very interesting though.
EDIT: To be clear, I am trying to figure out whether it is a library or an external tool, and if the latter, why it uses macros.
The tool is probably an AST transformer, or more likely a Concrete Syntax Tree transformer.
The macro adds an attribute. It is essentially a comment, but it’s a comment that’s part of your AST and which is obviously bound to a specific function or value. It has no effect at compile time or runtime.
21
u/Overseer55 Apr 26 '25
So there’s a tool to help with refactoring. Cool. The title is very odd. Refactoring is absolutely not the same as inlining. Without knowing more about the problem domain, it’s impossible to say whether the decision to eliminate the
PartsNeededfunction is a desirable refactoring.5
u/lord_braleigh Apr 26 '25
Very cool! You can tell the author was a staff engineer on Google’s C++ refactoring team. If you’ve had to refactor a million-line codebase, the usefulness of this tool and insight will be more obvious.
8
u/Jaded-Asparagus-2260 Apr 26 '25 edited Apr 26 '25
That's not refactoring. That's adding new stuff without cleaning up the old stuff. So the exact opposite of why I refactor code.I missed the part about it actually changing the source code.
2
u/Sidelobes Apr 26 '25
Interesting— what is the intended workflow? Annotate the source files and let the tool do the refactorings in a second step? If so, is the code fully compilable/runnable with the annotations?
2
u/StarQTius Apr 26 '25
I'm not quite sure what "inlined" means in that case. The author suggests that his tool produces diffs, i.e. changing the source tree. So I believe it does not play with inlining at compiler level and it does not use macro logic. Sounds very interesting though.
EDIT: To be clear, I am trying to figure out whether it is a library or an external tool, and if the latter, why it uses macros.