Why VB.Net is bad

Why VB.Net is bad

If a language is going to be loosely typed, then that’s fine as long as you know how to use it. If it’s going to be strongly typed that’s even better. So in JavaScript:

var i=1;
var j="1";
if(i==j)alert("Loose typing ahoy!");

Everything’s fine and you get an alert. And if you go:

var thingArray = new Array();
thingArray[i]="Loose typing still ahoy!"
alert(thingArray[j]);

You get the same thing.

Try something similar in C#, and you’ll get a compile error:

int i = 1;
string j="1";
if(i==j)Response.Write("Oooooh badness");

So it will never work.

In VB.Net, though, we’re in a funny middle-ground where things are sometimes the same, and sometimes different:

Dim i as Intger = 1
Dim j as String = "1"
If i = j Then
Response.Write("They're the same here.")
End If

So far, so ropey, and not that dissimilar to JavaScript. But then:

Dim thingArray as new ArrayList
thingArray.Add(i)
If thingArray.Contains(j) Then
Response.Write("They're still the same...")
End If

will never write anything out. Because despite the fact that 1 = “1”, an ArrayList that contains 1 doesn’t also contain “1” because they’re different…

It’s a cop-out of a language, I say.

Leave a Reply