VB.NET vs C#: Auto Compilation and Case Sensitivity

by bob on May 15, 2007

Jeff Atwood has capitulated. In a post titled C# and the Compilation Tax he says he’s through pretending that .NET is a multi-language environment. C# is, according to Jeff, what everyone is using.

But there’s a fly in the ointment for him, and it’s C#’s lack of background compilation. He protests that he’s wearing out his Ctrl-Shift-B key.

I say, long live Ctrl-Shift-B. Maybe it’s just me, but when working in VB.NET, I find myself racing to complete thoughts before the overly-helpful IDE starts highlighting half-written lines of code telling me they’re incorrect. Okay, okay, for God’s sake JUST LET ME FINISH!! I prefer to work out a bit of code and then compile it when I’m ready. How hard is one keystroke anyway? Sheesh.

Jeff also says that case sensitivity is evil. Prior to working in C# I lived most of my life in either VBScript or Visual FoxPro, both of which are case-insenstive, and I had no particular opinion about the matter. When I wrote my first couple of C# programs, I found case sensitivity mildly annoying, but the IDE trained me quickly enough and then I began to like it. Now maybe this is like someone getting taken captive and coming to like being beaten, but I don’t think so. I really like the semantics of having member fields in lower case and properties in camel case. It gets rid of all the shenanigans with leading underscores or “m_”. VBScript wasn’t object oriented in any meaningful way, and Fox called fields properties and had clunky semantics for getting property-like behaviors such as lazy loading, so the usefulness of case insensitivity was probably lost on me at the time. But since .NET raises the issue, case sensitivity is a nice solution.

I also like consistent naming; the inability to case the same variable three different ways makes for clean code.

As Jeff willingly points out, these are all religious issues and there isn’t really a right or wrong answer. Personally while VB.NET is okay and I don’t wring my hands (much) when I have to work with it, I never really had any great love for VB and never even considered subjecting myself to the needless political issues that surround it. I had enough of that over the years with FoxBase and FoxPro. There is no FUD factor surrounding C#, and it has that je ne sais quoi of all the C family languages. People who write checks think you’re more capable if you can parse curly braces and semicolons. It’s not fair, and it’s not true, but it’s nevertheless the case that if you use C# you don’t have an uphill battle fending off mindless disrespect for your use of a “toy” language.

The truth is that most trivial programs compile the same in VB.NET as C#, if you take the semicolon off the line ending. With minor differences in edge cases, you can do everything in one language that you can do in the other. It truly is down to nothing but personal preference. So I willingly embrace case sensitivity and manual compilation … although having the option of auto compilation in C# would certainly encourage more VBers to join us.

Come, join us. We are your friends. We only want to help you. Don’t be afraid.

Update: It appears that I’m not the only one who finds VB.NET’s background compilation to be an annoyance!

{ 1 comment… read it below or add one }

Jasmine May 15, 2007 at 12:28 pm

No you’re not the only one. I can’t stand VB because of that. It wants to finish things for you and keeps flagging errors that aren’t errors. I like to write empty blocks to begin setting up my code structure, and in VB, there’s not a good way to do that without using a lot of “end” statements.

Leave a Comment

Previous post:

Next post: