Wednesday, 11 November 2009

Current Obsessions: Part 3 - VB and C#


There is something I have been embarrassed to tell anyone. Even my close friends don't know the depths to which I have gone. Only one friend, somebody I met through role-playing, knows the sad truth, and he has good reason. He works for Microsoft. And I program using Microsoft Development tools.

It all started in 1994. After a bad time failing my Chemistry degree at Reading University, and instead learning about all sorts of exciting ways to hack Unix, I had ended up with not much other than the ability to make exciting reactions, and program in Modula 2, Ada, Fortran and Basic. It was the latter which saved me.

Whilst I had been brought up roughly knowing a smattering of BBC Basic, I applied myself properly at learning how to hack the QBasic bundled with the DOS 5 on my father's new PC. Responding to an advert, I got a job working for a small company in Surbiton, Perfect Software, which wrote accounts software for solicitors. My job was to convert the TurboBasic program that existed into a Visual Basic 3 program. This was an excellent way into the IT industry for someone who essentially had no paper qualifications. I also became a massive fan of everything Microsoft.

Visual Basic was probably the most popular development system in the world in the 90s. The language was easy to learn, allowed you to create a workable GUI in minutes, was forgiving of mistakes, and most importantly, provided an automated memory management system. In fact, most people didn't know that a memory management system existed. In many respects, this was its downfall. If you were a C/C++ programmer you had to understand what a pointer was; but the entry level for Visual Basic required little knowledge and understanding in comparison. So, on average, there were more bad VB programmers than any other kind. It must be true, because I have met so many, or rather, have cleaned up way too much of their shitty code.

Of course, I considered myself to be pretty hot stuff - in the VB world, you understand. I gained knowledge of how to use a lot of the internal Windows functionality that was glossed over by the nice, easy to use toolkit. I learned scary things like creating COM objects out of User Defined Types and using arrays to access arbitary memory locations. But still, I felt that there was something missing. Something that many people have labelled C++ Envy. This was a condition that caused many VB programmers to think that they were second class citizens when compared to Visual C++ programmers. Maybe this was because the documentation for Windows assumed you were writing in C or C++. Or that all the really hardcore applications seemed to come with the Visual C++ runtime library. Or that VB didn't support inheritance. Even when native code compilation appeared in VB 5, it still seemed so unfair!

At the end of the 90s, news came to the VB community that Microsoft was planning a new initiative which would bring VB up to parity with their C++ brethren. Visual Basic 7 would come with inheritance and other more advanced object features. They would share run-times and documentation with all Microsoft languages. Suddenly, VB programmers could hold their heads up high.

Unfortunately, it became apparent that it wasn't quite as simple as that. Microsoft, for many good technical and financial reasons, had designed a new virtual machine, the Common Language Runtime, and essentially twisted Visual Basic to fit in with this new model, called ".NET". It turned out that the new language was incompatible with the new language; and even if you used the VB6->VB.NET converter, a lot of the code still had to be rewritten.

There was a massive split in the VB community. Some people were happy to move to a new system which gave them new abilities and some advantages. Others were furious that they would have to rewrite their code without getting a lot in return. The arguments became quite personal and vitriolic. There are certainly people to this day who have not (and probably will not ever) forgive Microsoft.

As for myself, I eventually saw both points of view. But then again, I didn't personally own thousands of lines of production code to be rewritten. I would happily take the money, although rewriting code never seemed a particularly fascinating job. Of course, it eventually happened that I had to do just this. It was probably one of the most annoying experiences in my life, because the converter seemed not to understand whole chunks of my code. In the end, there was so much code to change, I took the plunge and went to rewrite the lot in C# instead.

When it was said that VB would have parity with other Microsoft languages, this hasn't been strictly true. It turns out that Microsoft's own language, C#, is actually more capable overall. It is now my language of choice. Like Java, it is descended from C++, and runs on a virtual machine. Unlike Java, it supports pointers and a greater number of value types. (See this article for a full comparison). The features I absolutely love are Generic Types, simplified enumerator objects, delegates, and with version 3, the amazing Linq sub-language.

Ironically, after all the fuss, it has been thanks to both VB.NET and C# working on the same platform which has made it so easy to jump ship to C#. I'll be surprised if there are ever as many VB.NET programmers as there used to be VB programmers.


  1. Not sure if Start Trek is also an obsession, but I am starting to get rather obsessed by knitting at the moment, and rather like the odd episode of Star Trek.

    So imagine my unbridled joy when I saw that Niftyknits knits meerkats in the style of Locutus of Borg to order!

    I think I need to have a lie down...

  2. Oh yes and I do get your follow-up comments emailed to me

  3. Knitting? Never got into that, although it is something that I had classified as "it would be nice to learn". I have been told it is great for people who would normally fidget if there was not much to do.

  4. "People who fidget" is me in a nutshell. Personally I don't knit myself but I am inspired by the army of graffitti knitters on twitter. Check out Purlinterrupted and whodunnknit for a little bit of knitting related blogging mischief. There is just far too much fun to be had with blogging and knitting, a whole world of laughs that we barely scratch the surface of

  5. The same as me, apparently. I remember the day when I accidentally locked out my mobile when waiting for people in a pub, because I couldn't resist trying out "options". I have a guitar to provide the function; but the problem is that you can't carry it around with you very easily; and anyhow, people tend to get annoyed with my "twanging".

  6. You need a pair of knitting needles my friend...

  7. Oh my God! Not another language to learn!

  8. It's so unfashionable these days to say you are into all things Microsoft. I think that this is a bit of a shame, as in the days of VB dominance they were really a company to be respected. I think (and some would say feared)

    I think the blame should rest squarely on Steve Balmers shoulders. Newsweek this week talks of him as being a good businessman but not really a computer geek. That's what MS really need, a geek at the helm and since they lost that Gates touch they have gradually become the laughing stock of the IT world (albeit still a very powerful one)