C# vs VB.NET

Kirk (one of my new colleagues at Xero) and Phil (one of my old colleagues at Trade Me – Phil, where’s your blog?) have organised a C# vs. VB.NET debate for the Wellington .NET users group tonight.

Should be fun.

My predictions:

  • Most of the audience will be C# developers;
  • Few of them will have ever used VB.NET in anger;
  • Despite that, they will have already convinced themselves somehow that VB.NET is inferior;
  • None, if challenged, would be able to build anything using C# that Phil couldn’t build just as well in VB.

Meanwhile, important problems remain unsolved.

:-)

Update: I’ve responded to some of the comments and emails generated by this post in a subsequent post called Parlez vous Anglais?

18 thoughts on “C# vs VB.NET”

  1. Yeah you maybe right but VB.NET has far to verbose method declarations to be taken seriously, the constructs just seem clumsy.

    I’m mean Overridable, NotOverridable, MustOverride, MustInherit etc etc? come on!

    virtual, final, abstract for mine are sooooo much better

    Just because you can do everything in a language doesn’t mean you should.

    Extension Methods will only help.

    ;)

  2. > None, if challenged, would be able to build anything using
    > C# that Phil couldn’t build just as well in VB.

    This isn’t the point. Different languages have different levels of expressiveness and also different aesthetics. A program written in Haskell may be 10 times shorter than the same program written in C++ for example [1].

    In Ruby I can write this:

    10.times { |i| puts i }

    But in C# I have to write this:

    for (int i = 0; i

  3. I’m sure you can do *mostly* the same with vb than with c#. Except for unsafe code and external etc.
    The biggest difference is that in VB you will have to write far more code (punch a lot more keys) and you end up with code that is far more verbose and less readable than C#

    Not to mention that the flow of the language,IMHO, is counter intuïtive. Most languages that are used on the web (javascript/c#/actionscript/…) currently are based on C. So I guess it makes more sense to stay in the same mindset/paradigms.

    2c :)

  4. A few months ago I proposed that VB is the best language currently available:
    http://justin-michel.spaces.live.com/blog/cns!AE9441BAE91063CC!202.entry

    And also what I think would make it better:
    http://justin-michel.spaces.live.com/blog/cns!AE9441BAE91063CC!203.entry

    Contrary to one of the comments above, I believe well written VB should be faster to type than C#, because there will be less typing. This is because VB can have less reliance on two-key combinations which are more difficult to enter. (e.g. Shift-_, Shift-(, Shift-), etc.) There is also much less need to type capital letters, as VB will automatically correct the case of symbols to match their declaration.

    Without Resharper VB clearly has a far superior IDE to C#, so rather than bringing VB up to the level of C#, I would say the new version puts VB clearly back in the lead. (Although I’ve only used Resharper for C#.)

    For I = 1 to 10
    WriteLine(I)
    Next

    seems much better than the Ruby or C# equivalents. It doesn’t rely on any funky special symbols, and is therefore readable without any training or documentation.

  5. The cool kids are all using Java with eclipse!
    If you ever find your self typing too much you need to learn your IDE better.

  6. Um, Now wich loop is cleaner.

    ‘ Visual Basic
    Dim drv As DataRowView
    Dim s As String = “”
    For Each drv In DataView1
    s &= drv(“CustomerID”).ToString & ” ”
    s &= drv(“CompanyName”).ToString & ” ”
    s &= drv(“City”).ToString & ControlChars.CrLf
    Next
    TextBox1.Text = s

    // C#
    string s = “”;
    foreach (DataRowView drv in dataView1)
    {
    s += drv[“CustomerID”].ToString() + ” “;
    s += drv[“CompanyName”].ToString() + ” “;
    s += drv[“City”].ToString() + “\n”;
    }
    textBox1.Text = s;

    code ref:(http://msdn2.microsoft.com/en-us/library/wbe40x3x(VS.71).aspx)

    I code both C# and VB.net I am very familiar with both. C# is cleaner and is written like most languages are written. I also code java why because C# is so similar that the learning curve was about 2 hours.

    Dim is dumb.
    What the hell is &=
    and “\n” is certanly easier to write than ControlChars.CrLf

  7. I’m no VB.NET guru, but I would write something like …

    Dim drv As DataRowView
    Dim s As String = “”
    For Each drv In DataView

    s = String.Format(“{1} {2} {3}{4}”, drv(“CustomerID”), drv(“CompanyName”), drv(“City”), ControlChars.CrLf)

    Next
    TextBox1.Text = s

    That doesn’t feel too broken to me?

  8. These arguments usually go no where. My two cents is speaking from my experience only. I know it will ruffle a few feathers, and perhaps your experience may be different, but I have known mine to be true in too many cases to be conincident.

    C# programmers by virtue of the langauge and by its strictness produces better programmers generally speaking because it doesn’t hide the plumbing that VB does. Also, since VB allows you to get away with practices that go against OO methodology, VB practitioners use them and hence become dependent on them. This results in sloppiness.

    Now before the VB programmers start screaming at me, I am the first to say that there are exceptions to the rule. But note these are exceptions.

    When one matures past the vb mindset and starts learning C# and C++, they enter an arena of agile practices, design patterns and advanced concepts. When one enters Visual Basic (Beginners All-Purpose Symbolic Instruction code) they enter an arena where the users need something like the My namespace because most of the developers didn’t know how to do things such as communicate across forms and didn’t know the true namespaces of where important things were in the first place.

    I truly do not mean to sound harsh. I was a VB guy myself and I was just as defensive as most are. But when i made the transition to C#, my life changed, the way you lookk at things changes, and i have personally grown so much as a developer that I thank the person who insisted I get out of the VB mindset.

  9. After reading all your contributions I’m still CONFUSED!!!I’m a student doing a database development project. I know I need to move from VB6 but can’t decide whether to move to VB.Net or C#. I know VB.Net will be much easier but I also want to develop as a programmer. I’v got one monthe to develop the application & the database.can anyone give advice that isn’t BIASED?

  10. you just have one month to develop it? then stick to Visual Basic 6! as long as you do your system right it is OK…

    there is no time for you to relearn it and make the system under one month… Yes I like VB but i need to learn VB.net and C#.net also. IT people just need to update their knowledge…

  11. hmmmm wait its is 2008 and they are still teaching VB6 in your school? no who wants foxpro? i hate it! waa hehe

  12. Due to the demands by our customers, my company (a software house) is switching from VB.Net to C#. Thus I don’t see any bright future for VB.net.

  13. I was a Visual Basic 6 programmer. From my experience, moving from VB6 to VB.NET is very UNNATURAL. It is more confusing & difficult for VB6 programmers to learn VB.NET, because we tend to think in VB6 when coding VB.NET.

    In term of performance & simplicity, VB6 is better than VB.NET. For those adapt to OO designing culture, C# is a more natural choice.

Comments are closed.