First Commercial C++ Development Refactoring Tool
swrittenb writes "According to their recent press release, SlickEdit Inc. announced Visual SlickEdit® v9, the first commercially available development tool with C++ refactoring. Although this area has been studied, and non-commercial refactoring tools for C++ exist, how comfortable are people using an automated solution for refactoring with this particular language?"
Well, when you consider that a compiler is also "an automated solution for [code] refactoring", I guess anyone using C++ (or any other compiled language) is reasonably co[m]for[t]able. (I assume that's what you meant.)
Nope, it's not the same thing at all. The transformation from high-level to low-level code is much simpler than the converse; that's why you can't decompile a native-code executable, even an unstripped one, and get beautifully formatted and readable code out of it.
I trust my compiler to output valid machine code precisely because machine code is so simple. C++ is very complicated; if I were a C++ programmer (which I'm not, I prefer simpler and safer languages) I'd definitely be keeping backups of my unrefactored work for a while.
I don't have a problem with any refactoring tool if it allows me to see what changes it made (Kind of a no-brainer), and allows them to be undone if the results aren't too great after you do it. Even better is if they integrate with a tool's undo or redo, if they are hosted in an IDE like VS .Net, JBuilder, Eclipse, etc.
Sure, it's tricky to insure that more complex refactorings do what they say, and sometimes they do change the semantics, but in a way you want. For example, moving methods up/down in a hierarchy.
And the simple refactorings are still really useful. Rename X is just really, really nice.
I want a syntax cheker running while I am editing the source code.
Example 1: When I am writing: "printf("Hello %d\n", "world");" I want a red line under "world", with a mouse-over stating: "Integer, not string expected in printf format string". I want this to happen while i type.
Example 2: When writing: sinus(3.14); I want a red line under sinus(), with a mouse over explaining "Call to function sinus() without prototype" without running the code trough a compiler.
I also want sane syntax highlighting. I want it to highlight the things that I look for when I am browsing trough lost of code. That is my function and variable names. All other should be kept in low key (eg. if while for int struct etc.). I am not sure if i want call to libc to be highlighted. Show me the important stuff, not the cruft! Editors are not too bad on this (or can be customized), but when I press print in emacs or use gnu enscript, it prettyprints all the wrong things, and hides away the important stuff.
RFC1925
how comfortable are people using an automated solution for refactoring
A fair number of proficient C++ programmers make a great living refactoring other peoples' mistakes.
In an average project, most objects and methods are still damn far from being prime.
"Provided by the management for your protection."
Most of the features are simple search and replace operations. Just add some knowledge the compiler would have to the editor and it becomes quite easy to do
hmm... lets examine them then.
Rename
So say you want to rename A::foo() to A::bar(). But foo() is private - so the tool has to look only in the current file, while for protected the file and its children, while the entire project if its public. While its rather easier to limit private and public members, how about protected? What if there is B::foo() as well? what if B::foo() is used in A?
Extract Method
This usually works when you select a piece of code and want to extract it to a method. search and replace? umm yes. How about the method sanctity? Wouldnt the tool need to ensure your extracted method is remains unbroken? what about the variables used in the selected segment? Are they declared within the selection?
Convert Local to Field
A::foo() has "myLocal", and so has A::bar(). Upon refactoring, should "myLocal" be replaced within with the new field in A::bar() as well?
Convert Global to Field Instance
A::Global is made a field. But A::foo() has a local variable Global defined as well. Should the tool do its job silently or inform you about this?
Convert Static Method to Instance Method
ditto
I haven't read the specs of the tool, so I don't really know if it performs all this validation. I sure hope it does, if they want to sell it to anyone else other than mom and pop
Just my $0.02
http://efil.blogspot.com/
Patrick Doyle
I mod down every jackass who puts his moderation policy in his sig. Oh, wait a sec....