KevinUp

real world programming

vb

Posted by kevinup on October 6, 2008

I recently finished a seven month assignment. It wasn’t anything glamorous. It actually was somewhat miserable at times. The worst thing about it was the client wanted their solution in VB.net. At first I was thinking, that’s ok, I’m a multi-lingual kind of guy. I prefer C#, but I’ve done some VB.net in my past, so it shouldn’t be that big of a deal. The assemblies are the same, it always compiles down the same or similar IL right? While that’s all true, I could never be so wrong about being multi-lingual.

Let me start of complaining about the IDE. In C#, when I was creating a class, I would drop in my private properties first. Then traverse back through and simply right click on the properties, and select ‘encapsulate method’. The IDE would code out my public properties. This would allow me to create my classes pretty quickly. In VB.net you get nothing. I thought initially it was a mistake. I checked on a couple other developer machines, and I got the same result. So instead of it taking 30 seconds to create a class, it took 5 minutes of boring copying and pasting.

Next: There is no extract method. Like any good developer I like my methods to be short, quick, and concise. A good method will usually start out around 5-10 lines. As the code matures, it might get to 15-20 lines, which I consider the max a function should be. Above 20 lines, its time to refactor your code. At this point I like to evaluate the method and try and isolate a couple lines that are specialized enough to be its own method. At that point you can highlight those lines, right click, select ‘extract method’, and BAM!. Done. In VB, not so much.

Next: Nullable types. I love nullable types; I don’t know how I used 1.1 without them. In C# a nullable type is declared as: ‘int? myInt’. In vb you can to say: ‘dim myInt as Nullable(of Integer)’. If you do that a couple times it will make you want to shoot yourself. The same applies to generics. A generic list in C# is just: ‘List<int> myList’ in VB its ‘dim myList as List(of Integer).

Those are my main gripes about VB.net. I found it so frustrating that I went to the client multiple times to try and convince them that C# was better, with no luck. The application had been in production for 4 weeks and generated 2.5 million in revenue by time I left. They were impressed enough that they offered to hire me away but I had to turn them down with my number one reason being VB.net. Ironically the week I was leaving they decided all new development would be in C#, and re-offered me the job again. C’est la vie. Too little to late in my book.

Advertisements

2 Responses to “vb”

  1. Have you checked out the freely available Refactor! for Visual Basic from devexpress? http://www.devexpress.com/Products/Visual_Studio_Add-in/VBRefactor/

  2. kevinup said

    Nice, this could have saved me a couple buckets of puke. Hopefully I don’t have to go over to the dark side again, and if so, this should help. Thanks Mike!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

 
%d bloggers like this: