C# and the Compilation Tax

Over the last four years, I've basically given up on the idea that .NET is a multiple language runtime.


This is a companion discussion topic for the original blog entry at: http://www.codinghorror.com/blog/2007/05/c-and-the-compilation-tax.html

The Telerik converter looks pretty useful.
http://www.codechanger.com/

I never did understand why VB was included in .NET. But, I guess that it makes sense given the legacy/compatibility issues that may arise.

C# code looks a lot better, to me, than VB code. It looks more like professional code, rather than play code. (I mean no offense to anyone. I am currently a VB .NET developer.)

Other than that, I have no real preference. They both do the job.

I have to chip in about the evil that is background compilation in VB.NET. Here at work we ahve a largeish project (200k+ lines) and decent machines (oodles and spare ram).

but any time a new file gets opened the IDE will freeze for 10 seconds while is background compiles everything. about twice a day this will result in the VB.NET compiler crashing and the IDE going down with it.

maybe if they managed to make a robust compiler and got the background compilation happening on a low priority thread on the background instead of freezing the IDE and all my work it would be a worthwhile effort, in the meantime i’m constantly searching for a way to switch it off.

Build a bridge and get over it.

I was once a VB developer. It was a liberating experience to be free of all the bad VB habits. VB lets you be lazy, even if you are not a lazy programmer. C# , look at the plethora of knowledge at your fingertips from sibling languages. Object oriented programming, design patterns. The mental gymnastics to covert Java examples of design patterns to VB was at best a nightmare. I don’t even look back. Its nice to do one thing and do that one thing well.

"Button button = new Button();
Employee employee = new Employee();

etc. Naming is not only about variable names.
"

  • Martin Vilcans on May 15, 2007 04:21 AM

Personally, I absolutely hate code like that. Why? Because I like to read the code, and when I’m reading there is no distinction between “button” and “Button”. Also, of course, “button” tells me nothing about what the variable is for, just what it is. I already know that. “executeBtn” or “theBigButton” or “somethingToClick” are all more meaningful than “button”. IMHO, case preservation is vital (“GetThere” and “GetTheRE” lead to significantly different interpretations), but relying on case insensitivity is a major maintenance nightmare.

Diatribe aside, I would LOVE to see a “case correcting” IDE. If I have the above case and I have “case correcting” on, then “bUtToN” would get a red squiggly if it really couldn’t tell what I meant (or it would look at the context, determine that I am using it as a variable name, and in the variable name space there is only “button”, so it uses that). For that matter, I’d also love to see a yellow squiggly when I type a variable name which differs from a class or method name only by case, but that’s just me …

IMHO, if you haven’t tried working in an IDE like IntelliJ (or to a lesser extent Eclipse) then you’re in for a treat there. Much of what has been asked for here has already been provided by other IDE vendors, just not necessarily for a C#-oriented IDE. This is one of those things that always makes me scratch my head when developers go on about how great VS.NET is as an IDE; am I missing something, or do they just not realize how much Microsoft is missing here?

In C# you can have unicode in identifiers, and the case folding rules are not completely defined or even sensical. So, the problem is simply avoided by abandoning case insensitivity.

I hear you, but…

If the language keywords are ASCII, why not restrict the identifiers (variables and function names, etc) to ASCII as well? I don’t see the point of this. It’s not like C# itself can be localized, so the keyword “if” doesn’t become “si” in Spanish or “wenn” in German.

Wasn’t there a previous post where most people agreed that Visual Studio was the best IDE? Netbeans, JBuilder etc. displays the errors while you type. It even adds them to a list so that you can click on the error message and jump directly to the code. They can even detect errors in one class, when another class has been changed. (the last one requires that you compile the updated class though)

lol - vb.

poor loser.

This is one of those things that always makes me scratch my head
when developers go on about how great VS.NET is as an IDE; am I
missing something, or do they just not realize how much Microsoft
is missing here?

I think most of them is blinded by the ease of building GUI applications, and they overlook the features of the actual code editor. Features that other IDE’s (like Netbeans, JBuilder and IntelliJ) have had for years.

IDEs are a waste of time. All this wasted effort searching for the one true IDE could be spent using an editor and the commandline which are far closer to perfection than the any bloated IDE.

I can’t imagine someone building a complex system in a command line shell.

Then again, who am I?

Intellisense is enough of a background syntax checker for me, and I love it! I am wearing out my period and tab keys…

@Roddy, don’t forget that Delphi.NET has a fast compiler when you do need to compile.

@steve, case insensitivity is a good thing. Variable declaration is reversed? Don’t be so hard on C#. :wink:

Hi,

You might want to take a look at ReSharper by JetBrains.

It solves the recompilation issue while adding a lot of other nice features.

Yes, I have heard of this Resharper thing…

http://weblogs.asp.net/jkey/archive/2005/01/29/363227.aspx

… see comment #6 on this post from January 2005.

And I’m still left wondering why background compilation is missing from Whidbey (late 2005), and Orcas (late 2007/early 2008), and Rosario… the misses just keep on piling up for this “unimportant” feature that so many people seem to strangely fall in love with.

Odd. Very odd.

Hi,

I can’t shake the feeling that VB.NET is an unwanted bastard child within the .net development team, or - in another words - they (are forced to) drag it along for compatibility reasons. Let’s not forget VB6 project upgrade wizard that is still along for the ride. Anyone wondered why?

In another hand, as vb.net developer that does development for a living I’ve been tempted to switch to C# (as ALL of my former VB6 colleagues have) but have decided not to persuaded by all the propaganda from Microsoft - that all .net languages are equal.

Well, they’re not. There are plenty of examples of what VB.NET can’t and C# can do - and they are not language specific.

I wonder for how long will this “unwanted child” continue to live, or in another words - when will Microsoft decide to discontinue VB.NET development…

Imagine the press MS would have received if for VB devs there was no VB.NET. Adoption of .NET might have been a bit slower. Most of the people coming from VB went straight to VB.NET thinking that they are on an absolutely equal standing with C#. I cannot tell you how many times I saw a VB.NET developer after being forced to use C# never went back. This is not to say that VB.NET should die or whatever. If someone wants to use it, go ahead and use it.

And also, I get a feeling the author of this blog loves setting fires :slight_smile: Topic like this always brings loads of discussions and meaningless back and forth comments between various thought camps.

Like Jeff said, I’d strongly suggest you check out Resharper.

Among a million other useful things (like finding class/member usages, which you mention) it highlights compilation errors as you go.

Since I started using it a couple of years ago I don’t develop without it.

I think the problem is that there is a compilation step in the first place. Why I just can’t run my application right out of source code? I wish JIT compiler would be able to accept raw VB.NET or C# just like it does MSIL.

While I can’t say I have ever worked with .NET (wrong platform for my taste), you seem to be mixing together “language” and “IDE” in your article. Is this compile on the fly really a language issue, or is it merely the IDE of your choice that has this limitation ? I know Eclipse has a C# plugin, and most Eclipse plugins seem to have the compile on the fly feature. Maybe give that a shot ?

I do agree though that the discrepancies between VB and MSVC (those are the last versions of both I worked with, I assume it’s similar to VB.NET and C#) always bugged and irritated me as well.