
Visual C++ Refactoring - flipchart
http://visualstudiogallery.msdn.microsoft.com/164904b2-3b47-417f-9b6b-fdd35757d194
======
ygra
I 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
I 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.

~~~
flipchart
I'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

~~~
CraigJPerry
Probably an impedance mismatch here, i think the parent is thinking in terms
of git (or a.n. other DVCS) where constantly making atomic commits is very
natural.

I suspect from what you're saying you're using something else.

E.g. day to day i use subversion. It's possible to adopt this workflow in
subversion but it definitely takes more effort on my part.

------
matiu
That's been in kdevelop and qtcreator for like forever. I'm surprised MS took
so long to add it.

~~~
vincentkriek
Exactly. 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.

~~~
flipchart
VC++ 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
Windows 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
On 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.

------
72deluxe
And 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
Automated refactoring was one of the promises of Clang. Does anyone know how
that's going?

~~~
tterrace
I 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)

------
alextingle
What's wrong with "sed -i"?

~~~
adamnemecek
The fact that it does not understand the language.

~~~
alextingle
This 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
>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
Congratulations. Your refutation of my argument is very persuasive.

