5 points · by makecheck · 18y ago · 8 comments
I think it's because I can't imagine a tool being able to handle all the "quality" aspects of large scale code changes. For example, a symbol browser might not see #ifdef'd-out blocks; a parser may find references to X in code but not in comments; and aesthetics like proper indentation may be lost. In other words, if I let a robot "fix" things and move on, I may be burned down the road by confusing code or comments.
Are there good refactoring tools that I've just missed? How do you handle major code changes?
Eclipse has some nice tools that automate processes like pushing up methods into superclasses etc... so if you're looking for commercial 'tools', look no farther than Eclipse.
Still, do not underestimate the power of a sound mind and a good text editor. Personally, I hate how "refactoring" is being marketed these days; mostly caused by the managers/business side of software engineering. To me, refactoring is nothing more than reviewing code, cleaning it up, using better algorithms, altering for better readability/writability...
"The aim of our studies must be the direction of our mind so that it may form solid and true judgements on whatever matters arise. We must occupy ourselves only with those objects that our intellectual powers appear competent to know certainly and indubitably." Descartes
:%s/find/replace/g
./setup.py test
I've also got a find/sed script for doing find/replace across a whole directory tree.I really do miss having the semantic refactoring tools that are available in Java IDEs, though. That's one area where I think Java (and Smalltalk) really leads the pack, and the rest of us are blubbed into accepting half-assed solutions. Sometime I should check out BicycleRepairMan, but as I understand it, it's still not as robust as a provably-correct refactoring in a typed language.
Btw, for those put off by the term "Test-Driven Development", its really the "bottom-up programming" you'd do in the more dynamic-languages. That's my take on it anyway.
I occasionally do larger level renames using the tool, but I'm always a bit wary. It's peripheral stuff that I'm worried about, as with you. Any more major surgery is usually done by hand.
Now, if my tool had better refactorings, I would probably use them.
I have a personal rule that no variable name can be completely contained within another variable name (e.g. $Cust and $CustName must become $CustNbr and $CustName). This is the perfect application for a tool. Yet I never wrote it. I WANT to painstakingly walk through every line of code looking for this. I WANT it to hurt. I want to train my inner hacker to do things right the first time. What better way than to suffer the consequences?
We train our mind, our bodies, even our spirits. Why not also train our inner hacker? A few extra minutes per day is well worth it.