Mixing It Up

For the past 2 days, i’ve *finally* had the opportunity to work in both C# and Visual Basic simultaneously! It might seem like quite a lame goal, and yes, it probably is. But it was interesting none the less, to dynamically compare the two languages, and bonus- getting paid to do it- ie not doing it at home after hours as part of research or interest.

The functional library was written in VB [WebChart by blong] which didn’t quite have all the functionality we needed. But it did provide a good fit. On the negative side, it didn’t come with a set of test suite *shock.horror* The rest of our web application is almost entirely C#.

The day arrived on Monday when WebChart needed to mature and we needed to do the moral thing. Add tests. The test code itself was written in C# and this was the perfect platform to code simultaneously without “looking” for an excuse, erm, opportunity to truly compare the two languages.

After a few days of implementing in VB.Net and then directly using the implementation from C#, i still prefer C# but definitely have less of an aversion to VB.Net. I’m glad to see VB and array indexing has come of age. Yes, but not just reading about it- actually using it. There’s something about us programmers ‘cos we don’t trust documentation; no thanks to years of bad SDK’s. We only believe once we see something in action, and that, in production on our system.

The { } are by way FarMoreEfficient than the End … statements. More readable and when you’re looking at nested loops, the


For Each ...
For Each ...
Next
Next

was not as easy to find as


foreach(...)
{
foreach(....)
{
}
}

And using [] for arrays/lists is nicer than () which usually refers to a method, i mean Sub

Etc.. etc.. And many before me have waxed lyrically about the two languages, but i’ll stop here.

If anything, it provided a good mental workout jumping between the two so dynamically. But there were [lost] times when i stared at the screen wondering why the *&%#! the following


Private Function GetLegend() As SortedList
int index = 0;
End Function

would just NOT compile 🙂