I’ve been a big proponent for language equality and have been very vocal in stating that really there’s no big technical reason that C# or VB.Net should be the preferred language for anyone, after all for the 95% part the languages provide the same capabilities in regards to .Net. However, I’ve also been open and have clearly stated that I code exclusively in C# - purely out of my own preference not because of any specific technical reason. In fact although I can read VB code just fine, if I had to write VB.Net code I’d be back to square one looking at the help docs every few minutes to look up the various language constructs.
But an interesting thing happened today: I was reading through a magazine article which had some lengthy source code provided in VB.Net. It was some verbose piece of code dealing with WMI. And it struck me how ‘ugly’ this code looked. The code was good – the author used clean abstracts and the code was documented, but still the code just seemed messy to me.
The argument often used against C# is that its syntax is cryptic with all of its curly brackets and too strict with its case sensitivity and enforced semi-colons as line delimiters. But as I looked at this VB.Net code I realized that I really would have liked to see this code in C# for – believe it or not – readability.
Even though I agree that C# and all other C derivative languages seem a little arcane at first, especially when you’re not used to typing ‘those’ characters, in odd sense of way the code provides a clean look that is easier to read. Not convinced? Open up any of the MSDN code samples in the help file that have both VB and C# code and look at them side by side. You’ll find – without directly examining the code - that C# is more open. There’s more white space and because of the curly bracket notation too you have everything clearly delimited in a way that sticks out. Both things together make for code that is actually easier to grasp and read. Compared to the C# code the VB code looks very blocky and bunched together.
It’s a small point but I find it interesting how perceptions can change relatively quickly. I’ve used and still do use Visual FoxPro daily for example. VFP like VB has a blocky syntax and I feel similarily about the VFP code now.
From a visual perspective I’ve noticed that I’m longing for spacing out my code and when I work on VFP code these days I tend to leave lots of extra white-space between blocks of code. I also find my self sticking semi-colons into the code where they don’t belong …
Readability is a funny thing – it really changes how you look at your code and how ‘feel’ about it.
Again, this is a pure subjective thing - I have no interest in being a part of the religious war that some people want to wage, especially the VB folks who seem to feel slighted because there is seemingly more C# code published especially by Microsoft.
I find this penis envy by the VB crowd actually quite amusing. As if the VB folk had a reason to complain! Here we have VB.Net being pretty much a full scale citizen in the .Net universe at least from the Microsoft end. Microsoft is obviously very interested in VB developers. But, nope not enough for the VB crow. Fickle be thy nature - people get up in arms quickly if a bad word is uttered against VB be it from within Microsoft or without (and without is really where it's coming from the most).
Yet in the days of VB 6 the VB folks were so proud that VB6 was the 'most used development tool' in the world and that it was the highlevel tool of choice. Heck, I can't remember how many times in a discussion with VB developers I had VB people absolutely try to crush Visual FoxPro pointing out the death is imminent and that the tool is a toy, not fit for this or that. Yet, sure enough we were doing it. VFP developers for years and still have to deal with this stigma and there is plenty of whining about that in the VFP community, but at least there was something to really whine about! Now VB folks think they are feeling the same sort of backlash...
On the other hand I also find it interesting how much bullshit comes out of magazine editors in this debate. ASP.Net Pro for example, with their downright telling people to switch to C# because they'll make more money and because it's perceived as a more robust language. That seems pretty harsh coming from a magazine - which is basically alienating a large chunk of the readership.
Coming down on one side or the other, always pointing out the minor benefits of the chosen language. Everybody has their preference, but we should all agree that choice above all is a great feature! It would really suck if Microsoft had just decided to give up on VB altogher and just build C# instead! Think about that next time you want to complain that VB isn't getting enough attention!