Sunday, 3 June 2007

Background compilation needs an on/off switch

Jeff Atwood has written a couple of entries recently about the C# Compilation tax and an article comparing Background Compilation and Background Spell Checking

I find the background compilation in, as it is currently implemented, does not work well for me. I often write the main structure of my code(which doesn't compile) and then fill in the gaps. And tells me it's wrong; except it isn't wrong, I just haven't finished. Ian finds this annoying as well and calls it Background Irritation.

Although it is, in someways, comparable to background spell checking, I find it is as irritating as MS Word's AutoCorrect. AutoCorrect decides that what I just typed is not what I meant to type and changes it. This works fine for "teh" and other such errors, but often AutoCorrect changes TLAs and other words until the meaning of what I have just written changes completely. Worse, it does it without telling me, which is very frustrating. But, I can switch it off when I know that I am writing something that it will cause me hassle with. In fact, now I think about it, I even use spell checking like I use the compiler. I write my text, I scan it to make sure that I think it's ok and then I ask the spell checker to double-check for me.

So what is wrong with background compilation? I want it on when I am bugfixing. I want it off when I am writing from scratch. I want it to work like that in c#. I don't care if it is on by default. But if it doesn't have a switch I don't want it. Therefore, for a tool to be useful to a good developer, it needs to be written as something that can be reached for when needed.

And on the subject of the c# compilation tax, VB.Net's bacground compilation is not free. The MSDN article Scaling Up: The Very Busy Background Compiler has some hints to help with large projects. But the idea of changing my code or switching off other features to help the performance of another feaure that I don't always want on, just seems to reinforce my perception that this needs a switch.


Anonymous said...

I don't see the point about what is wrong with background compilation. Having a word with a red underline looks like nothing for me.

If you have not ended writting the red line will go when you end. That's all isn't it?

I mainly use Vb.Net instead C# because background compilation.

James Geall said...

The problem isn't that it shows a wavy line. In fact when I want it on, I like the fact that it does. But it isn't useful all of the time, and sometimes because of the performance issues, it is actually counter productive. I'd rather have intellisense and more importantly, text appearing when I type, and not some wavy red line. And at those times I want to be able to switch it off. So my point is not that background compilation is bad, just that no choice to switch it off is bad.

I don't want the switch to be changing the language I write code in.