Why I prefer c# over VB
A couple of weeks back I was asked by a friend of a friend why I code in c# over VB. I didn’t give him a very good answer at the time as I just couldn’t pinpoint the reason. Since then I have had a real good think about it and have come to this conclusion. It just looks bulky. Not a good reason I know. I am not what you would consider a power developer, I use .net for relatively simple tasks and there isn’t any feature I would consider using one language over the other. So for me it just comes down to aesthetics. I can and have programmed in both classic VB and VB.Net and it was only about 4 years ago that I decided to have a look at c#. Now when I look at old code I have written in VB.Net I not only shudder at the overall crapness of my code, but also the amount of non-whitespace. A simple while loop in VB looks less clean than its cousin in c#.
1: Dim counter As Integer = 0
2: While counter < 20
3: counter += 1
4: End While
1: int counter = 0;
2: while (counter < 20)
3: {
4: counter++;
5: }
For me the second code example is easier to read, I know the while construct has ended by the placement of the closing brace I don’t need 8 superfluous characters to tell me that.
I was brought up with BASIC on the Commodore 64 and then Amiga BASIC through vb2,3,4,5 (didn’t really use vb6), then VB.Net and now c#. I do feel to a certain extent a bit of a traitor.
As has been reported elsewhere, word is that inside Microsoft they are trying to align the language development teams more so a particular feature that becomes available for one language will immediately be available in others. Will this blur the choice between languages?