views:

211

answers:

8

I notice that I tend to fix one error, then recompile, then fix another one. SOmetimes if there are problems with many files I might fix one per file. How about you?

+7  A: 

I normally don't have errors when I compile; I compile because I want to run the code. My IDE tells me about errors/warnings in a little status bar on the right hand side. Compiling to check syntax seems so last milennium.

krosenvold
Just a pity the VS C#/ASPX parser gets it wrong so many times! Interesting, compiling, makes VS realise it's error, and remove it from the error list.
leppie
Back in the days of the .NET 1.0 beta, I started with C#, then had a go with VB, and because the VB IDE's pre-compile and intellisense were already loads better, my productivity soared. This difference remains the case with VS2008, and is the main reason I wouldn't go back to C# for my main work.
ChrisA
You get it all with resharper
krosenvold
A: 

I usually try to fix everything I can identify (ideally all), although, admittedly, sometimes it is a bit hard to keep track of it all.

It is not too hard to get to projects that just takes too long to compile, and doing so just to find which errors I hadn't fixed yet is just too wasteful and would drive me mad.

Yossi Dahan
+2  A: 

If my compilation is sufficiently quick (and, let's face it--it sucks when it isn't), as little as one, sometimes a few more. The problem is that errors tend to cascade, so one error can lead to 100 other false positives.

If I can tell that a problem I fix is going to be a problem elsewhere I'll often fix it at the same time. Likewise if I see a message of something that clearly isn't a false positive I will probably fix that too.

cletus
+1  A: 

I usually only get multiple compilation errors when I've done something like adding a parameter to a method, leading to all callers failing to compile. At that point I just go through each of them in turn to fix them, possibly recompiling after I've finished each particular file (so if files X, Y and Z have three errors each, I'll fix the three in X, compile, fix the three in Y, etc). It's not a particular "rule" though and it doesn't really matter so long as you've got a sufficiently fast compilation cycle.

Jon Skeet
But you're a resharper user, right ? Doesn't resharper support "change method signature" with "propagate changes", like IDEA does?
krosenvold
It might do - not sure. Likewise Eclipse might, which is what I use at work. However, I generally want to check every call site anyway, so it's not really a problem to break the compile and then visit each one via the error list. If I were deleting a parameter, that would be a different matter :)
Jon Skeet
torturing yourself to consistently use this feature can reduce compilation issues to near zero. After a few weeks of torture you get used to it. Wouldn't know how it works in eclipse though..
krosenvold
but you're right about the call sites. We still have to do *some* work
krosenvold
Exactly - if I've got to visit each call site anyway, how is this going to save significant work? (It's not like it's even taking a significant portion of my time anyway.) I'll check out the feature anyway though, just to educate myself...
Jon Skeet
You can modify many layers transparently. Quite often you only need to inspect the top-most call site
krosenvold
A: 

Usually I don't find any error during compilation time-- any such errors are highlighted by Resharper in IDE without me commiting the compilation at all.

Ngu Soon Hui
A: 

When I work with compiled languages it's often small projects and compilation is very fast. I think I sometimes compile after each keystroke. =)

Anyway, for me the issue is if my tests run. Then my pace often is "write a test, implement it, make it work" (repeat). But I'm starting to enter the field of BDD and then my pace is somewhat less fine grained.

PEZ
+1  A: 

As previously mentioned, compiling to check syntax errors isn't as common now with modern IDEs. It's not so much syntax errors now, it's the logic errors you have to worry about that your compiler won't pick up (unwanted endless loops, if (x = 1), etc...).

A: 

Quite often one error can lead to several others further down so I tend to look at the errors and then choose my approach.

Of course the other variable is how long it takes to do a compile. I've worked on systems where it took 12 hours to do a total build, but thankfully those days are over. (-:

I guess nowadays I tend to take a "fix the first one then recompile approach" especially when I'm working on something where I can either perform the compile or run the script within vim. I map a key, usually v, to write out the latest copy of the file I'm working on and then either compile or run the script. Something like:

:map v :w<CR>:!%<CR>

when I want short code and test cycles.

HTH

cheers,

Rob

Rob Wells