First Commercial C++ Development Refactoring Tool 63
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?"
Refactoring other languages... (Score:4, Informative)
We're already comfortable with compilers (Score:5, Interesting)
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 conformable.
Since there are no constructors or templates or multi-expression tests ( "if( a && b || c && d )") in any machine's assembly languages, we all trust our compilers to generate assembly language that corresponds to the high-level language constructs we've actually written -- and in the case of the control expression to that "if" statement, we trust the compiler to know and follow the operator precedence for the language being compiled -- and in C and C++, the required "short-circuit" evaluation too.
That said, a good bit of that trust -- for C++ and C -- reposes in rigorous language standards and (more or less, I don't want to argue about language (mis)features or hacks for backward compatibility) well thought-out language designs.
(That's one of the many benefits of a rigorous, documented language standard, by the way -- do you know if, in scripting language "S"( where "S" may be Perl, windows scripting host, visual basic, or what have you), short-circuit evaluation of logical operators takes place, or if there's a sequence point between each one? Not to bash any one language, but for Perl, deja-googling shows sequence points have been an unresolved issue since 1998.)
To the extent that a refactoring tool's design is based on standards and on thoughtful and an open -- not proprietary -- processes that bring in opposing and skeptical views, as do the design of C and C++, I'd be reasonably willing to, in Reagan's words, "trust but verify". But if the refactoring tool is the proprietary product of a closed shop, I'll be far less confident that the Marketing Department didn't;t have too much of a had in product "design".
But however the products comes to be, the proof remains in the use -- let's see how the automatic refactoring compares over several real-life projects before trying to judge.
Re:We're already comfortable with compilers (Score:5, Insightful)
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.
Re:We're already comfortable with compilers (Score:1, Insightful)
Re:We're already comfortable with compilers (Score:2)
Ha, good one!
Patent? (Score:1)
Personnally I think pico, nano, and notepad are the best refactoring tools out there, and two of these were commercial apps so I don't see how this is the 'first' commercial refactoring tool.
Extremely Uncomfortable (Score:3, Funny)
Thank you.
Re:We have shit tools (Score:3, Funny)
Of course, it's a tough sell to try to fight emacs and vi...
Re:We have shit tools (Score:2)
Re:We have shit tools (Score:2)
Re:We have shit tools (Score:1)
Re:We have shit tools (Score:4, Interesting)
Um, in addition to Windows, it supports:
Linux kernel 2.4 and up
AIX 5 and up
HP-UX 11 and up
IRIX 6.5 and up
Solaris SPARC 7 and up
(tig)
SlickEdit. (Score:5, Interesting)
I've only had the chance to use it under Windows, but I understand there's Unix and Linux versions available too.
My opinion: If you're going to pay for an editor, this is a good one to pick.
When it comes to refactoring, I can't comment - I've not used this version, so the feature is new to me. It sounds like an interesting feature, but in honesty, I can't see us making much use of it.
Re:SlickEdit. (Score:1)
Re:SlickEdit. (Score:1)
Sure, why not. (Score:3, Insightful)
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.
What I want (Score:5, Insightful)
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.
Re:What I want (Score:2, Insightful)
Yeah, agreed, it would be savage. I'm busy, so you go code it up and I'll buy it. A plug in to XCode would be wonderful, thanks, and while you're at it do *something* to make all the other pop ups work properly.
Gawd, all the shit about CASE tools, you would have thought someone like Rational wo
Re:What I want (Score:4, Funny)
[cheapshot]
I can't imagine why you feel you need a checker for the code that you type..
[/cheapshot]
Re:What I want (Score:2, Informative)
Re:What I want (Score:2, Informative)
Description reads as:
Re:What I want (Score:1)
Well, see, it's like this... (Score:2)
You toss around demands like "while I type" and "without running a code through a compiler." Now tell me just what you think is going to be doing the checking.
Detecting the examples you gave require at least a parser, and some minimal semantic analysis. Parsing takes up the bulk of compiling time in C and C++, and you're not going to get that in a heartbeat.
How often is this mini-compiler supposed to check your code? Constantly? It'll be siliently getting errors in the background, as it waits for y
Re:Well, see, it's like this... (Score:3, Informative)
Re:Well, see, it's like this... (Score:2)
Re:Well, see, it's like this... (Score:2)
The smart way to do this, of course, is by making the editor able to share a front-end with the compiler itself. Possibly even make them all part of the same program, like many of the IDEs.
I know of a variant on GCC where the front-end would dump a kind of XML representation of the program's identifiers, for cross-reference building. An editor would better off asking the compiler to do the work like that, rather than doing it on it
Re:Well, see, it's like this... (Score:1)
my master's thesis defended that as an editor there is nothing wrong with gnu/emacs that a "next-generation ctags" couldn't fix - and a few
Re:Well, see, it's like this... (Score:1)
It's worth noting that in Eclipse (and from what I gather, most other IDEs), the assistance provided is done not on the basis of a full file reparse each time something new is typed. Rather, the IDE keeps the parse around after the initial parse, and when it notes that a portion of the document has changed, it usually is able to get away with just reparsing a small area around what was changed, and modify it'
Not the first by a long way (Score:3, Informative)
Marketroids at their best (Score:2, Informative)
- Rename
- Extract Method
- Encapsulate Field
- Convert Local to Field
- Convert Global to Field Instance
- Convert Static Method to Instance Method
- Move Static Field
- Move Method
- Replace Literal with Constant
- Create Standard Methods
It does not seem overly complicated to me, to implement these.
Most of the features are simple search and replace operations. Just add some knowledge the compiler would have to the editor and it bec
Re:Marketroids at their best (Score:5, Insightful)
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
Re:Marketroids at their best (Score:2)
B::foo() is a completely separate function from A::foo() and should not be renamed. It is easy to tell which one A wants to call because the call method would differ (b->foo() as opposed to foo()).
> 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?
No. myLocal in bar() is used for a different purpose from the one in foo(). There is no
Re:Marketroids at their best (Score:2)
I was just elaborating on the fact that such a refactoring tool is more than search and replace, as was mentioend.
IMHO, refactoring tools make can be quite useful in tidying up the code, be it yours or written by someone else. However, to categorize them as a glorified search/replace t
Re:Marketroids at their best (Score:1)
Sure, but what if you had 'x->foo()'? You have to know the type of variable 'x'. This is not a simple search/replace operation, unless you can do type analysis with a regex (you can't). Then again, maybe your editor does search/repl
Re:Marketroids at their best (Score:2)
Sure. The compiler needs to know it too, so all the necessary headers will already be included.
> This is not a simple search/replace operation, unless you can
> do type analysis with a regex (you can't).
If you intend to write your tool entirely in regex, good luck to you. You already need some type analysis to match types to variables for field extraction. Parsing type declarations is not that difficult and then you just m
Re:Marketroids at their best (Score:1)
The original post suggested that the marketing department was giving fancy names to simple search/replace operati
Re:Marketroids at their best (Score:2)
Not really (Score:3, Informative)
What is Refactoring?
Refactoring is a disciplined technique for restructuring an existing body of code, altering its internal structure without changing its external behavior. Its heart is a series of small behavior preserving transformations. Each transformation (called a 'refactoring') does little, but a sequence of transformations can produce a significant restructuring. Since each refactoring is small, it's less likely to go wrong. The system is also kept fully working after eac
Job Security Endangered (Score:3, Insightful)
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.
Re:Job Security Endangered (Score:2)
1. These tools don't make decisions about what to refactor - you tell them what has to be done, they just do it for you.
2. Humans tend to introduce errors in tedious, monotonous situations.
Proficient C++ programmers are paid and valued for the knowledge they bring with themselves, which is
Re:Job Security Endangered (Score:2)
Tell me about it. I'm a self-taught amateur who's trying to write a fairly complicated piece of software, and I can tell you that my code is far from being 'prime'. Lots of stuff that would be better as templates, or just resolving a pointer and passing it as a ref to an equivalent function ( i.e. operator=(myObject&) and operator=(myObject*) ) instead of rewriting what amounts to the same function only with a point
It's not an automated solution (Score:3, Informative)
> solution for refactoring
It is not possible to automate (as in "without any human intervention") refactoring because it requires understanding how the entire project works. Any tools you create may help, but they do not obviate the need for thinking and redesigning, the two tasks the computer is incapable of doing.
The tools are useful, but... (Score:1)
... if you read the description of the features [slickedit.com] that they've added, it isn't as impressive (to me, at least) as you would believe from the magic moniker "refactoring". They merely provide automation to refactoring tasks you could do by hand but which are more time consuming.
The comparison with a compiler is specious. Perhaps a better comparison would be to a macro assembler. But even then, the fact is the editor is not doing anything more than the body sitting on the other side of the keyboard.
What woul
together (Score:2)
Quoting:
"Refactoring
Support for Refactoring at Class, Attribute and method level. Refactoring means rewriting existing source code with the intent of improving its design rather than changing its external behavior. The focus of refactoring is on the structure of the source code, changing the design to make the code easier to understand, maintain, and modify. The primary resource book on ref
where are the docs ? (Score:1)
Here is one place that sells the documentation
http://www.programmersparadise.co m/Product.pasp?txtCatalog=Paradise&txtCategory=&t x tProductID=M39+017W
Their website does not sell the their own documentation.