Background Compilation and Background Spell Checking

Dennis Forbes took issue with my recent post on C# and the Compilation Tax, offering this criticism, pointedly titled "Beginners and Hacks":


This is a companion discussion topic for the original blog entry at: http://www.codinghorror.com/blog/2007/06/background-compilation-and-background-spell-checking.html

“Yes, you could throw Notepad.exe and volumes 1-5 of The Art of Programming at your development team. Or you can buy them the best, most advanced development tools on the market. Which approach do you think will be more effective?”

So subjective, “best” and “advanced” are. Let’s just begin by being very clear – Linus Torvalds does not use notepad, nor do any other top-tier hackers I’ve ever heard interviewed on this subject. Frankly, I’m sick of this ridiculous, dismissive comment. I hear it over and over again, and I can’t understand why.

If somebody chooses not to use a wiz-bang IDE, that does NOT mean they use the most primitive tool imaginable. They typically use a highly advanced development environment that they’re comfortable with. They just have a different definition of “best” and “advanced” (as do I).

I use an incredibly advanced tool to write code. It’s funny that you mention spell checking, because I can instruct my development tool to check spelling in my programming comments (or symbols, or …) just like Microsoft Word does. I have integrated compilation across multiple languages. Dynamic macros. Rich abbreviations (dynamic and static). Templates (aka snippets). Registers (my eyes well up when I just think about how much I love registers). Dynamic macros (yes, I know I already mentioned that, you have no idea how amazing they are if you are wondering why I listed them twice). Prefix commands. Massively splittable windows (vertical splits with bounded horizontal scrolling are a thing of beauty). Integrated version control. The list is really endless. And hey, even background compilation if you want it. You know, some really, really advanced stuff.

My tool is so advanced that sometimes I just take my fingers off of the keyboard and shake my head. It gives me power I don’t deserve to have.

Peter Norvig, Paul Graham, Dave Thomas, Guido Van Rossum, Tim Bray, Steve Yegge, and yes, Linus Torvalds all use very, very advanced tools [1,2]. In many, if not most cases, it’s the same tool.

  1. http://usmanahmad.wordpress.com/2006/08/02/great-programmers-answersinterview-with-steve-yegge-linus-torvalds-dave-thomas-david-heinemeier-peter-norvig-james-gosling-guido-van-tim-bray/
  2. http://www.paulgraham.com/pfaq.html

A background spell check is much more useful than a background compile. You will always have to compile, and therefore you will eventually find your mistakes.

However, background spell checking is there to help those who don’t run a spell check before sending their document.

Compilation always happens in the process; spell checking is optional.

I really think they should’ve stopped halfway between what VB6 had and what VB2005 has.

VB6 didn’t check the syntax until after you’d moved onto another line (it also doesn’t highligh while you’re changing the line). Unfortunately, it would tell you about any mistakes with a dialog box. Worse yet, if you’d noticed and had already hit the up-arrow key, when you pressed enter to dismiss the dialog box you would get sent to MSDN (the up-arrow having changed the focus to the Help button).

The spell-check style squiggly line is great compared to this dialog box, and the suggested fixes have saved my butt sometimes. They are especially useful when you know what you want to do in C# or VB6 but the slightly different syntax trips you up. Having a single click “this is what I meant, fill it in for me” is really good.

Throwing a squiggly line at you after having typed only the ‘i’ in ‘if’, though, is really annoying. It’s as condescending as someone assuming that you’ve gotten the answer wrong before you start answering it.

(For the record, the grammar check in Word annoys me in a similar fashion, though the spell check is alright)

I turn off “spell check as you type” when I’m really trying to put words on a page. All those squiggles just distract and delay you. Give a href="http://www.hogbaysoftware.com/product/writeroom"WriteRoom/a (or its PC equivalent) a try and I bet your essay writing productivity will go way up.

I think the distinction here is that the primary audience for spell checking is pretty much the whole world, while the audience for background compilation are software developers who are notoriously obsessive compulsive.

For example, I love Resharper which places little yellow warning lines off to the side for lines of code that could be “improved”. I find I have to fix them. I can’t help but notice them, despite how inconspicuous they are.

My point?

I think background compilation is fine, but it has to be as inconspicuous as possible. It has a higher bar in being non-intrusive than spell checking. It can’t slow my IDE down.

For example, I think a delay in background compilation warnings may actually be a good thing. I notice as I type this that the words aren’t spell checked as I type them. It waits till I’m done. And the red dotted line is pretty subtle. As I type, what I’m typing is never slowed by the spell check. That’s how bg comp needs to work.

are basically saying anyone who uses VS2005’s tools to their advantage is a shoddy programmer. It’s elitist crap.

Speaking for myself, I’m saying no such thing, and I think the assumption that I have can only be attributed to defensiveness, with people automatically reading into every statement exactly what their preconceived notion is.

Hi there Jeff. Very interesting post.

Regarding the recurring comparison between spelling and automatic background compilation, I offer up-

http://www.yafla.com/dforbes/2006/10/24.html

Try to wrap your head around that seeming contradiction.

Yet it isn’t a contradiction, and the difference between the two is the crux of the whole debate that is missed by quite a few people.

Any time after I needed to do an install of VB6, the first thing I’d do as soon as the MsgBox popped up for the first time was turn off the auto-syntax check. So no big deal or reason to hate VB - it only bothered me when I paired up with other developers and they had left the option on; some of them have actually liked the feature. FWIW I also turn off auto-spellcheck in Word and click F7 when I’m done editing. Oh, I also dislike the auto-capitalize first letter of a sentence in Word, and make sure to turn that off as well.

Back to VS 2005…I’d just like to see both C# and VB.NET with the same option - background compilation and squigglies that can be turned off. Which one is the default shouldn’t matter; any good developer before doing any coding will take a few moments after a new install to import his preferred settings file or manually set them up in Options. I’m not going to judge a programmer regarding his own personal preferences, unless he just leaves the default options as is out of the box out of laziness, and has taken no time at all to actually learn the IDE and what options are available.

I agree with you 100% Jeff. I hate not having background compile in C#. That is one of the best features in VB that is not in C#. I mean you can always turn background compile OFF if you don’t like it, but why not include it to begin with?

I had ReSharper at my old job (adds background compile to C# among other things) and I do not have it at my new job and the lack of background compile in C# is driving me crazy.

Excuse me but um, am I the only one to notice that background spell-checking is just that – BACKGROUND, whereas VB used to pop up a DIALOG BOX saying you have typed an incorrect line?

Jeff – the second guy you quoted expressed frustration at his compiler’s OBTRUSIVE notifications of his error, not the INOBTRUSIVE squiggly lines!

Greg

I just wonder why a completely ignorable feature forces them to feel such anger. It’s not like the editor stops working if the compiler finds an error while you’re typing. It’s not like it isn’t easily hidden.

I also find it arrogant. Griffiths attributes errors VS shows him to be simply because he hasn’t finished yet. Wow, so impressed.

I also enjoy the distinction on Forbes’s blog that a feature like IntelliSense, which helps you do something right the first time, is “a great bit of functionality”, while background compilation, which tells you immediately when you do something wrong, is bad. What’s the difference? Is there a huge gap between “This is what you should do” and “This is what you should not have done”?

When we hire people, one of the most important questions/tests is to make sure that someone knows how to use his/her tools properly. I’m not saying it is improper to ignore errors caught in the background, but if someone knows how to use that knowledge to their advantage, if it makes them more efficient and bug free, why is that bad?

Further, I don’t buy the argument that it is a beginners-only tool. I’m gonna learn from my mistakes whether the compiler tells me I did something wrong now or later. In fact, I think I’d be more likely to remember the things I did wrong if I’m told of my mistake immediately. Better to fix one error while it is fresh in your mind than 30 after you’ve written 100 lines of code.

Ironically, Jeff had to email me to point out that I had spelled his surname wrong in the post he references here. :slight_smile:

But back to the topic at hand…

A few people already nailed it, but since you called me out specifically, just to confirm: yes, I love continuous spell checking and I dislike the grammar checking.

The main reason is simple: continuous spell checking mostly only bugs me after I’ve made a real mistake. Grammar checking bugs me for no good reason all the time.

That’s the thing about spell checking: for a usefully large subset of spelling errors, it is possible to tell immediately and without context that an error has been made. (And I always use styles that enable me to mark something as “not to be spellchecked” when writing technical documents so that it doesn’t call out identifiers as errors.)

But the thing about any kind checking of broader syntactic is that context is everything.

That’s why spell checking is reasonably unobtrusive, while grammar checks (either by Word or VB) are plain irritating.

And of course I rarley make spelling mistakes.

It may also interest you to know that I do a ‘compile’ stage on my spell/grammar checking. There’s a litle tick/cross thing on Word’s status bar that lets you know whether Word is happy with your document. You can click on that to find the first problem if it’s a cross. I aim to get a “no warnings” build of a document. Often this consists of overriding Word’s ideas about grammar, which (a) don’t match UK expectations and (b) don’t cope well with some of the bizarre repurposing of words we perform in the software industry.

To be fair to VB, I think part of the reason I got so annoyed by this feature was back in earlier versions of VB, the default behaviour was essentially modal: it would try to prevent you from moving away from the offending line until you had fixed it. By contrast the whole reason squigglies are a good invention is that they got rid of a modal feature. So I got in the habit of turning the feature off in VB in order to get any work done… I’ve not yet done any serious VB development on VS2005 - the last time I did any real VB.NET coding was in VS2003 - so maybe it’s better than it was. Perhaps I now remember it as being more annoying than it is.

But if it’s as annoying as Word’s grammar checking then it still sucks.

Despite having been a device driver writer (and, way back, a big Linux fan), I’m definitely not a “no tooling” guy. I love IntelliSense, and I find the tooling for things like Ruby and JavaScript feels like stepping back into the dark ages.

FWIW, until fairly recently I also composed my blog posts much as Jeff does. However, I lately built some infrastructure that allows me to use Word to write it all, while keeping the relatively tight style of HTML I like to use. The reason? So that I could get Word’s continuous spellchecking to work for me. Despite this, I still don’t like using VB on the whole…

Background spell checking only becomes a crutch if you use it without thought. When the background spell checker highlights a word rather then quickly clicking on the word for it to replace it with the correct spelling equivalent, I will edit the word and try to correct it myself. If after several tries I can’t get it I will right click the word, see the correct spelling, and then manually edit the word with the correct spelling. This reinforces the correct spelling so that I am less likely to misspell it next time. If one simply clicks and replaces with the right word without thought, they don’t really learn and it really does become a crutch.

Its all in the person if they want to use a given crutch to ‘get better’ or to ‘get dependent’.

At the risk of being buried beneath the previous 40+ comments, I’ll add my own to the mix.

Do all the background spell check, grammar check, or compilation that your little IDE/editor/tool-chest heart desires. BUT DON’T TELL ME THE RESULTS UNTIL I’M DAMN READY FOR THEM! Ahh, much better.

I want my program parsed and compiled as I code. I want my document to be parsed and checked as I write. But I absolutely, positively, cannot stand those stupid wiggly red lines. They are distracting to the extreme regardless of whether I’m writing prose or code.

So please, dear Sir, do your background checks. Thus, when I ask for the results, you’ll have them already in hand. I won’t have to wait 10 minutes for you to go get them. But don’t interrupt me while I’m writing!

You know, if you didn’t use IE, you could have spell check in for your blog entries too… Like this screenshot from Safari shows:
http://img120.imageshack.us/img120/2264/picture1yc6.png
Firefox does this too… but OS X is particularly nice because you can get spell check in every single standard text entry box in the OS. The red squiggles are usually disabled for fixed size entry boxes to satiate those that find it annoying, but you can hit cmd-; whenever in doubt.

Also, am I the only one surprised at how poorly Word shrinks? Compare to Apple’s Pages at approximately the same size:
http://img240.imageshack.us/img240/1779/pagesvswordwp2.png
(won’t let me make it smaller) You’ve still got double the actual work area! Typical MS toolbar mania.

haha… “spell check in for you blog” ? sigh…
Well, good thing they’ll be adding standard grammar check to Leopard as well… :wink:
http://thinksecret.com/archives/leopard9a377a/source/32.html

Is this not almost entirely down to its implementation?

Stephen, absolutely. The way background compilation was implemented in VB6-- as a modal dialog-- made it nearly impossible to use.

Yet [the fact that I applaud background spell checking] isn’t a contradiction, and the difference between the two is the crux of the whole debate that is missed by quite a few people.

I think a whole lot of coding is rote and mechanical, precisely the kind of thing that’s amenable to spell checking and grammar checking. No, background compilation won’t be accurate all the time. But to advocate that background compilation is “the hand-holding of beginners, and the crutch of hacks” is to move us in the wrong direction.

On the other hand, it’s fairly common to move away from a line of half-written code while you think “Oh, I want to do this to that variable, meaning it needs to be a Double, not a Float, better change that in the parameter list” or something similar. I’ll hardly ever leave a word half-written whilst I think “Ah, I need to change this chapter heading”. I’ll just spend the extra few milliseconds it takes to type the final few keystrokes. So background spell checking tends to catch spelling errors. Background compilation tends to catch unfinished lines, not errors (in my and, seemingly, Ian’s experiences).

I was mildly entertained to find “in particularly” in the Mike Pope quote…