Get your facts right.

I just read this article: http://www.simple-talk.com/dotnet/.net-framework/10-reasons-why-visual-basic-is-better-than-c/ . And I’m pissed. Why? Allow me to elaborate

First of all, because on the top right there is “a service from redgate”. You’d expect to get their facts right.

And that’s the main issue with this article. There will always be fights among developers about which language is better, VB.NET or C#. I don’t care. Use what works best for you. And I’m always interested in a well argumented comparison between the two. (and I’m not going to show my preference here, I worked in both languages, and I like to think I know what I’m talking about).

Alright, let’s take a look at Andy Brown’s points:

Point number 1

Not a good point to start with, very personal point, so I’m like: ‘whatever dude’

Point number 2

Again, bad point, it’s a language feature, I have no problem with typing out an if else statement. However the second part of your argument is utterly wrong. C# doesn’t allow fall through in a case statement, meaning the compiler will complain if you omit the break statement:

case fallthrough C#

Point number 3

If I change the name of my control in the designer it just updates everything. I guess your Visual Studio 2010 is broken.

Point number 4

The one I hate the most. Not only are you PUSHING your personal preference to other people, you’re doing it with the wrong arguments. Allow me to explain:

&& in C# is NOT And in VB.NET. The && is a Contitional And, the And operator is logical, meaning it will execute both sides. We can read this on the MSDN page on this topic.

Let me prove it to you with an example:

C# &&

As you can see it only executes the Foo one, it completely omits the Bar!

If we follow the ‘comparison’ Andy wrote this would translate to the following VB.NET code:

VB.NET And

Well, it seems that we need the AndAlso operator in VB.NET to get the same behavior. You can get the And behavior in C# by using a single & instead of a double.

The same is for the || and the Or, you need the OrElse to achieve the || result, or, to use the Or in C#, you need the single | instead of a double.

Point number 5

First of all this is a IDE feature, not a language feature. But fine, I’ll bite: you have that too in C#. Type prop+<tab>+<tab> and you’ve got your property.

Point number 6

You are relying on the Microsoft.VisualBasic namespace. If you want to you can even add it to your C# project. The issue with this function is the following: reading the documentation doesn’t give me a single clue on what the restrictions are, what culture does it use?

You can always do int.TryParse or double.TryParse. Hec, you can even do a Regular Expression like ^[0-9]$ and then something else for the commas. I’m not a Regex Expert, and probably never will be Smile with tongue out.

And for your PMT function (click, decompiled from the dll):

PMT

Point number 7

Language feature, personal preference. No argument there.

Point number 8

First you start off by writing how to declare and define variables and then you come up with the out keyword? And if you have problems with the out keyword, you do realize that VB.NET doesn’t offer a way to the programmer to restrict him to give either an initialized variable or a non initialized variable. VB.NET only supports ByVal and ByRef, where the first is always a pointer (like in C#) and the second one is ref. No out available Sad smile. And then there is this behavior: Force an Argument to Be Passed by Value.

Point number 9

An enum in C# is an enum, even though it inherits from int. It’s just the compiler that complains. Of all the things you mentioned you have a fair point here. I’ll give you that.

Point number 10

You say it yourself, the whole point of an array is that it is fixed size. Use a list. They’re there for a reason.

I do not want to rant. I just want to get the facts right. And I feel bad. From your bio I read that you are a trainer. While they don’t have to go too deep for an introduction, you should get your facts right.

Signing off,

-Kristof