10 ms·
Visual C++ Refactoring
- matiu 13y agoThat's been in kdevelop and qtcreator for like forever. I'm surprised MS took so long to add it.
- vincentkriek 13y agoExactly. Eclipse also has it, and I couldn't believe Visual Studio doesn't. It's so useful to just right click -> Rename an entity in code.
- pjmlp 13y agoThose three projects don't have the upper management Microsoft enjoys to dictate where developers spend their work hours. Similar to the functionality all Java IDEs have out of the box, but in Visual Studio you need Visual Assist or ReSharper.
- wfunction 13y agoWhich functionalities are you referring to?
- pjmlp 13y agoRefactoring and code navigation.
- wfunction 13y agoEr, you avoided my question. What kind of refactoring? What do you mean by code navigation?
- girvo 13y agoHe didn't really avoid your question. I parsed your question the same way.
- pjmlp 13y agoIf you have to ask like that, then you never used such features. Refactoring: - Semantic renaming of any identifier consistently across the whole source code - Transform code blocks into methods, functions - Move code blocks across modules, classes - Generate accessors, setters for a given instance, class variable - Change type of a given variable consistently across all the places it is used - ... Code Navigation: - Show call stack for every use of a certain method/function - Show all descendents of a given class, interface across the code base - Show all ascendents of a given class, interface across the code base - Show which classes, interfaces introduce, redefine a certain method - Show which binary provides the implementation of a given class, function - ...
- wfunction 13y agoNo, I was asking because you said Java IDEs have this feature but VS doesn't. Yet Visual C# out of the box has support for rename, method extraction, reorder parameters, field encapsulation, finding the usage of an identifier across the code base, generating a class graph, etc... Where exactly is Visaul Studio lacking here compared to your Java IDEs? Or are you comparing apples and oranges -- C++ to Java?
- pjmlp 13y ago> No, I was asking because you said Java IDEs have this feature but VS doesn't. Yet Visual C# out of the box has support for rename, method extraction, reorder parameters, field encapsulation, finding the usage of an identifier across the code base, generating a class graph, etc... No it does not. The amount of refactoring support out of the box differs for each Visual Studio version (professional, premium, ultimate, ...). Plus if I were to produce a comparison table, there quite a few refactorings from Java world that don't exit in Visual Studio out of the box. As a small example, finding the usage of identifiers only provides partial information of what Java IDEs are able to. Which can search for different ways the identifier is being used, being called, as a method, being assigned to, etc. As for plain C++, KDevelop, Eclipse CDT, Netbeans and QtCreator all provide much more refactoring support than Visual C++ ever did. I do like Visual Studio and use it since the first 32 bits only version, Visual C++ 2.0. But I am also aware of its defects.
- adamnemecek 13y agoC++ is also maybe an order of magnitude harder to parse.
- pjmlp 13y agoOf course it is, however my complaint was targeted to all supported Visual Studio languages. My employer won't pay for the listed plugins, given what is already being paid for MSDN subscriptions.
- flipchart 13y agoVC++ seems to have been given so little attention over the past years. I mean, even something like the new project wizard (which IIRC was due to be replaced when VS 2008 was around) is still untouched and completely different to the managed wizard. Maybe they've been too busy with C++11 feature implementation to actually improve the experience (and before that I imagine that .Net stole a lot of their resources). Of course now with C++14, they've got more work to do, so I'm not sure when we'll ever see significant improvements. It makes me sad, because being a C# dev, VS is very familiar, and to get a similar experience on the odd occasion I do write native code would be awesome!
- jasonjei 13y agoWindows C++ development on Visual Studio is composed of a lot of tribal knowledge. I am surprised WTL isn't even an officially supported framework, while they leave their ATL and MFC kits rotting in neglect.
- pjmlp 13y agoOn the Visual Studio 2013 release it was communicated they are still looking to what might be the C++ GUI framework for desktop Windows, but it won't be MFC. It is too old, based on C++ concepts that don't have place in a modern post C++11 world. WTL was never an official framework.
- pjmlp 13y agoFor quite some time, the .NET field had the upper hand and VC++ was left with a small team mainly dedicated to bug fixing. When the going native turnaround came about, they started staffing the compiler team again, but it does take years to recover what the .NET has enjoyed in the meantime. On the other side, the going native also seems to affect .NET side, with AOT compilation for WP8 and the new JIT/NGEN compilers being developed for the next release.
- aaronbrethorst 13y agoThere was no value in moving to a new wizard for VC, so they didn't. To their credit, they did accept some restyling work for their wizards. n.b. I worked on Visual Studio for four years and was the PM behind the managed wizard framework introduced in 2005 (which I've noticed is still around today).
- Impossible 13y agoVisual Assist X has had decent refactoring tools for Visual Studio for a long time (http://www.wholetomato.com/products/featureRefactoring.asp http://www.wholetomato.com/products/featureRefactoring.asp).
- ygra 13y agoI remember a VS developer once saying that they'd love to include more refactoring functionality; it's just that they want to be very, very sure that it cannot ever destroy your code. Eclipse doesn't seem to have that restriction and manages to mangle my code from time to time. Choosing names for automatically-generated members that clash with variables or fields already there (I know you are in rename mode afterwards, but this shouldn't strictly be necessary), or not recognizing the difference between this and SomeClass.this when extracting a method (it puts it in the wrong class). Perhaps there are people who take working refactorings over those that sometimes need massaging to prevent semantic and syntactic errors. (That being said, I probably never really used that much of what Eclipse offers in refactoring apart from Extract Method, Rename and Extract Local Variable. And I do understand that refactoring for C++ code is downright hard, if not impossible in the general case.)
- nextw33k 13y agoI find it really short sighted to say the IDE should never destroy code. Yes in an ideal world. However we have VCS to ensure our code is never lost. Before and after any refactoring you should be checking in. If the IDE got it wrong I'd revert and submit a bug report, no biggie. I want my IDE to be stable, fast and do as much for me as possible.
- pmr_ 13y agoI think the problem is refactored code that still compiles but fails in subtle ways now. Of course testing should catch that, but we have to accept that the reality of most testsuites is very different from the ideal.
- flipchart 13y agoI'm constantly refactoring my code. Yes, not all of them are solution-wide changes, but it would be a huge drain on productivity to check in my code between each refactor. I need to be able to trust my IDE that it will refactor properly and not destroy my code
- 13y ago
- alextingle 13y agoWhat's wrong with "sed -i"?
- adamnemecek 13y agoThe fact that it does not understand the language.
- alextingle 13y agoThis IDE refactoring tool clearly doesn't understand the language either, or it wouldn't screw up your code (as they clearly warn you it might). Personally, I'd much rather use a simple tool (like sed), with reliable, deterministic results, than something that's right "99% of the time". Sure, it tries to spot edge cases and flag them up to you, but if it's wrong some of the time, who's to say that it won't fail to spot an edge case 1% of the time too? So if it fails 1% of the time, and it fails to realise the problem in 1% of those cases, then it's introducing subtle bugs one time in every 10,000?? The very idea gives me cold shivers. Note: if they "improve" the tool so that it's right 99.9% of the time, then they've only made the situation worse. Now the bugs only crop up one time in 1,000,000 - and now they are even more subtle. tl;dr - a refactoring tool is 100% reliable, or useless. There's no in-between case.
- ksk 13y ago>Personally, I'd much rather use a simple tool (like sed), with reliable, deterministic results, than something that's right "99% of the time". >tl;dr - a refactoring tool is 100% reliable, or useless. There's no in-between case. lol..
- alextingle 13y agoCongratulations. Your refutation of my argument is very persuasive.
- 72deluxe 13y agoAnd what about XCode? Yes! That's right! It can't refactor C++! It can only refactor Obj-C and C. Quality! (I understand that C++ is not the focus of the Mac ecosystem but it was a shock when I attempted to refactor some C++ and it told me that it doesn't refactor C++. I was mildly sad.)
- farginay 13y agoAutomated refactoring was one of the promises of Clang. Does anyone know how that's going?
- tterrace 13y agoI ran across this yesterday (posted in 2011) about how google is using clang to automatically refactor their codebase: http://www.youtube.com/watch?v=mVbDzTM21BQ http://www.youtube.com/watch?v=mVbDzTM21BQ