Skip to content

C# vs VB.NET – which is better?

It never ceases to amaze me how every single programmer I’ve ever met has a strong and unshakable fundamentalist religious faith that the language they choose is the best and can provide a wide number of arguements for it.

Historically, you had to have a position on C++ vs VB. Visual Basic being a Rapid Application Development tool, or quick and dirty, whilst C++ was considered more elegant, resourceful and “manly”. VB required a library of additional runtimes and up until VB6 service pack 6, had a lot of bugs, mostly to do with memory management. C++ was always the domain of the purist, who would often look down on the VB guy and his less-efficient binary. C++’ers would snub VB’ers whilst in the office. VB’ers would snub C++’ers when down at the pub, enjoying a project-completed pint while the C++ programmer was still months behind…

VB, dubbed as VBA was the language chosen by Microsoft as a scripting language for their applications. As such, it was the first language used by businesspeople, accountants, scientists and the like who needed to code without needing to learn Object Orientation or non-intuitive coding symbols such as those found in C: {};*. VB was taken up by developers and managers who “just wanted to get things done”, and usually not caring a great deal over memory or sheer performance. For the heavy lifting, you would rarely use VB anyway.

At the end of the day, purist geeks and hobbiests versus owner-managers will be each to their own, but those who are paying for the development – the managers, business owners, and ultimately directors, investors and shareholders, will want the problems solved, quickly. They will not care about your factory classes, polymorphism or multiple inheritance. They will care if you spend ten times longer than you “should” be working on low level code when the business task necessites quick, rapid testing and deployment. A motto I heard at a Microsoft Conference for succesful software projects is, “Build early, Build often”. You often can’t build early (maybe not even for months) if you are particularly low level. You need to keep a bigger picture, get your first “build” out within a day or two. Trust me, I’ve seen many projects (not my own, thankfully) go to the wall because they didn’t get installers built early enough or didn’t have the technology choices down right at the beginning of the project.

There are some cases where both languages are useful. A quick couple of days in VB to prototype and demonstrate a new software tool, followed by C++ modules to do the number-crunching, with the interface in VB.

When Microsoft introduced .NET they made accessibility one of the main design goals. It now doesn’t matter which language you are comfortable with – they all go through the same MSIL compiler and the result is exactly the same. .NET is also fully Object Orientated, so if you’re coming to .NET from a C++ or Java background, you’ll find that line-for-line your code will essentially look the same. However, if you’re coming from Classic Event-Driven/Procedural VB, you’ve got to master Object Orientation.

However, now, C# and VB.NET are for all intents and purposes – exactly the same. With VB.NET, it is slightly more productive, you need less lines of code as the compiler makes more of an effort to understand what you’ve written without the need for end-line characters or curly-bracket delimiters.

VB.NET also trumps C# in a few other key areas:

  1. Background Compilation (instead of just a Parser)
  2. Edit and Continue (new to 2005 – and a massive productivity boost)
  3. Refactoring Support
  4. Ability to utilise existing VB6 code
  5. Code Snippets

I’m not sure why C# does not offer the above. I cannot see a technical reason for it, as essentially these productivity tools are down to the IDE.

If you were writing in Notepad, who cares which language you use? C# is probably neater for this type of grass-roots coding. But since VB.NET has the nicer IDE, I’ll stick with the more productive language of VB.NET over C#.

A twist to the tale..

Just checking the UK job market, as of today these are the rates for the VB.NET and C# programmers:

VB.NET Programmer, hourly rate
£34/hour, £36100/annum

C# Programmer hourly rate (22% more!)
£44/hour, £38500/annum

Today, C# Programmers are paid 22% more than VB.NET developers to write exactly the same .NET code!

My advice? Stick to whatever feels best for you. If you’re a dyed-in-the-wool C++ programmer, jump to C# and forgo the advanced IDE improvements for the VB.NET crowd. If you’re just starting out, I recommend getting a free copy of “VB.NET Express” from the Microsoft website – the language looks easier to read than C# and the productivity improvements will save you time. Time that you can spend on other persuits; like your family that you’ve neglected whilst you’ve been studying C++.

Useful Links:

C# to VB.NET and VB.NET to C# Converters

http://labs.developerfusion.co.uk/convert/csharp-to-vb.aspx

http://labs.developerfusion.co.uk/convert/vb-to-csharp.aspx

C# and VB.NET Language Comparison (if you read and understand this, you won’t need to use the converters)

http://www.harding.edu/fmccown/vbnet_csharp_comparison.html

Published inOld Evolved ISV PostsUncategorized

5 Comments

  1. I don’t understand the fuss – every .NET developer I know would be able to switch from one to the other with very little help (maye knowing the keyword differences like friend, shared etc.). It shocks me that C# developers get paid more, but I can’t say it upsets me 😀

  2. I agree with you and anyone that says C# is better than VB only succeeds in proving their ignorance of .NET technologies.
    The problem with the job marketplace is that it is driven by buzzwords – and being a C# coder definately sounds “trendier” than a VB coder.

  3. Having just worked through a fairly large project in C# I am reasonably happy with C# and wouldn’t touch VB. Purely because I spent my career working in C, C++ and Java, so the syntax is easier and more productive for me.

    I do however long for a decent IDE! VS is a horrible IDE, give me Borland any day of the week! But again perhaps my perceptions are one of what I am more comfortable with historically.

  4. As follow-up, I know the point you make about C++ developers being purist and elitest is true. You can likewise find old ASM developers who consider the C++ developers are uneducated speed freaks.

    We could say the responsability for this divide actually lies with microsoft, who introducing VB initially were aiming at the hobbyist/amateur market. However truthfully, it is just a part of human nature and no different from considering those supporters of a different football team to be inferior. 🙂

    And for the record.. “learn a REAL programming language!” 😉

  5. mikelwilson mikelwilson

    Thanks for the replies, everyone 🙂

    Although C++ and VB are like chalk-and-cheese, C# and VB.NET are basically the same.

    I don’t know many VB programmers who could quickly move to C++, nor many C++ programmers who could quickly become accustomed to VB. But then, VB does have some very bad things to say about it!

    Any .NET developer could move between C# and VB.NET at will and as the converters show, it’s not that difficult.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.