Alfred VS Clint: C# versus VB debate

Computer Science Teacher
Computer Science Teacher - Thoughts and Information from Alfred Thompson

Alfred VS Clint: C# versus VB debate

  • Comments 7

Clint Rutkas (who is better than everyone) Twittered his distaste for Visual Basic and preference for C# today. Now C# is a great language and I really do think that the features they borrowed from Visual Basic (properties for example) make it the best of the C family of languages. Visual Basic also had edit and continue for years and years before C# developers were able to convince the Visual Studio that they wanted it too. But to me C# not as clean as Visual Basic. So of course I responded right away. This lead to an Instant Message conversation and discussion of a nerd off. So here now is my defense of Visual Basic. Clint’s opening statements are on his blog here.

I have never been a fan of C style languages. To me the use of the semi-colon and curly braces are crutches for the compiler writers and hindrances for programmers. If we were going to go that way we could have stayed with APL – a very powerful language but confusing for programmers. And they are ugly and confusing too!

The required semi colon is particularly a problem. How many times have programmers, especially but not exclusively beginners, terminated a loop accidentally by placing an extra, and hard to see, semi-colon at the end of a line? And a missing or misplaced closing brace is a lot harder to find than a missing End If. Contrary to Clint’s claims I maintain that the code samples he shows prove that VB is easier to read.

And then these is white space. In Visual Basic white space means something and enforces some organization of statements. You don’t see contests to see who can write the least understandable Visual Basic code as you do for C (and could do in C#). Just because it was hard to write doesn’t mean it should be hard to understand.

Oh and did I mention the My classes? Not strictly a language feature but they do make it very easy to do some powerful tasks in Visual Basic programs.

Note: See also Line Continuation and Visual Basic – More on C# vs. Visual Basic and Visual Basic .NET and C# Side By Side

  • I hate the Visual Basic VS IDE and compiler. I have nothing against the language itself.

  • Call me when VB has anonymous methods... Of course, now, C#'s real competitor is F# :)

  • I completely agree with you Clint. I find that when developing applications that you need for somewhat simple tasks (like visiting a web page and reading information from it or updating a database) visual basic is a very logical choice because of it's simplicity and how it is very easy to understand. I think what makes any C language or java for that matter difficult to understand is that a } can end a while loop a do loop an if statement or any other number of things and when you want to add something to your code it makes things very difficult to find where to enter the code.

  • Sorry, I disagree. I started programming in VB1 and fell in love with that language. I was even one of the 15 customers who owned and developed in VB for DOS, and my time with VB6 was the glory days. I added an MCSD to top it all off. Great times. But when it was time to make the switch to VB.NET (which came later for me; around the VS.2003 timeframe), it was clear to me that VB.NET was not "your father's" VB. It felt very clunky how Microsoft approached it. It was clear that all the samples were being done in C# only, and VB always felt like an abstraction writing in--sorry--C#. I agree C# did rip off a lot of the great VB concepts, but that is what makes it so powerful in comparison to C. If they did add the "My" functionality, then I believe VB will fade into the sunset along with Fox Pro. C# is a very easy language and fits the framework much better. Frankly, I have enjoyed learning it and I would encourage all VB.NET developers to make the leap. I don't believe you will be disappointed.

  • I am VB.net developer and have a simple rule, if VB can't do it and C# can then do it in C#. And haven't reached at that point where I need C# :). But I suggest a developer should work with both languages specially C#, because mostly samples/tutorials are written in this language.

    There is concept which has made its roots a lot stronger that "C is a language of professionals while VB is for Beginners"

  • I use both C# and VB .NET.  To me there is no comparison, C# is the winner hands down.  C# offers many features that are not available in VB.

    1) Pre-Compiler Directives.  There is no such thing as a pre-compiler directive in VB.  THis makes developing systems much harder because you can not copmile for different environments such as a test environment.

    2) XML Documentation function headers are not available in VB .NET.

    3) OOP is rather clunky in VB.  For example, if you want to override a function with c#, the intellisense shows all available functions when you type override then space.  This is not available in VB .NET

    4) VB .NET is much too verbose.  When you have millions of lines of code to maintain, you do not want extra spacing, nor do you want to type EndIf thousands of times, } is much better. C# allows for more condensed code.  This is more more efficient from a maintenance stand point.

  • @Austin

    Well if you're just gonna compare features, why not use F#? It beats C# hands down for features :).

Page 1 of 1 (7 items)