VB and C#, Can’t we all play in the sandbox nicely?


One of the things I love about Visual Basic is that the syntax is similar to natural language.  This basic design make the code so much easier to read and elegant to me.


These are often words used to describe C or C#, but beauty is in the eye of the holder.


For example if I wanted to tell you about Sam I would say something like:


Sam is a man


I would not say


Man Sam


Yes.  This is less words but it goes against the natural grain of how I talk and how I think.  First I define what I am talking about, Sam.  Then I define what Sam is, a man.


Would anyone say that my second sentence is any clearer then the first or easier to read?


Why do some people insist that code should be written different then people naturally speak and think?  Why shouldn’t I write code for my sentence as:


Dim Sam as Man


Why make it say:


Man Sam;


Just to save a few lousy keystrokes?  If developer productivity is the goal then why case sensitivity? 


Maybe I am just weird but when I write with pen and paper I print, and I still print in all upper case.  My second grade teacher is probably rolling over in her grave right now, but yes I write in all upper case.  I have seen others and I know I am not alone. 


Maybe it is my wacky handwriting style but I just don’t get case sensitivity in a development language.  I don’t see how having two variables named Counter and counter be different variables is a good thing that should be allowed.  It just seems like a receipt for bugs and runtime errors.  One missed press of the shift key and there goes the application.


“;”, my pinker finger is the weakest finger on my hand, enough said.


I am sure my email box will be filled with lots of mail after this entry.  My intent was not to start up the language wars or to belittle C based languages.  In fact my intent was the exact opposite.  Visual Basic’s syntax works like my brain thinks, not everyone processes thoughts in the same way.  Diversity is great in life and it is great in development.  Use the language that works best for you and works the way you work.  That's why I use Visaul Basic, because it more natural for me.  I can write C# when needed but I prefer VB when everything is equal.


Maybe case sensitivity, semicolons and other differences make perfect sense to you; I have no problem with you being different.  I do have a problem when people start to claim to have spoken with the coding gods and know the one true language all developers should use.


If I read one more person saying the C# is the language of .NET or the language that everyone should use I am going to scream.  You want to know why lots of Microsoft folks demo in C# and not VB?  The answer is not some grand plan or any reflection of our product road map.  The reason is simple, most Microsoft products before .NET where written in C++, most Microsoft developers are C based developers so they demo in a style that they are comfortable in.


Why are commercial .NET based products from us like MSCRM, Sharepoint, and SQL Reporting Services in C#?  The same reason, these teams used to write their software in C++ so they naturally moved to C#.


Loads of internal software at Microsoft is written in Visual Basic 2003 and now 2005, why?  Same reason, because these teams used to use Visual Basic 6.0.  (FYI – If you did not know part of the .NET Framework is written in VB with even more of the 2.0 framework in VB).


Most people program in C# with .NET, right? 


Here are two simple thoughts for you, I would strongly bet that downloads of VB Express are higher then C# Express.  I also have a strong feeling that the VB Dev Center gets more traffic then the C# Dev Center.


Now stats can be bent to serve any point.  There are many, many C# developers in the world, my point is not VB is a superior language or C# is not widely used by lots of people but simply don’t write VB off anytime soon folks.  It is very alive and kicking.


While I am on my soapbox if one more person says VB is just C# without the semicolons I am going to go off the deep end.  I would argue the exact opposite, C# is VB with semicolons!


Why look at the changes from C++ to C#.  Managed memory, compiles to IL that runs against a runtime, edit and continue (in 2005), drop and drag Windows Forms designers, use of reusable components likes grids, no pointers, etc, etc. Doesn’t this sound like a lot of things that VB has done for years?  Isn’t the CLR a lot like the VB runtime (on steroids).  What did VB got from C++ things like i += 1.


IMHO the entire .NET development space has more in common with VB 6.0 than it does with C++.  Yes, it is have evolved since VB 6.0 and is different in some ways, but it is a lot more like building a Windows Form application in VB 6.0 then compared to building the same thing in a prior version of C++.


C# is great language for people that like C based language but for those of you that take this way to serious get off your high horse and stop claiming some sort of moral superiority.  Development is about using the best tool for your team to solve the business problem at hand; it is not about religion, world domination, or beautify crafted classes that took you months to design just because you wanted to feel smarter then someone else.  


To the thousands of C# developers that get this point, love what .NET gives them and love the C# language because it works great for them, keep churning out great applications and thank you for not lecturing me on using Visual Basic or trying to tell me it is a second tier language.


Ah, I feel better now.


Like I said, to all of the C# developers that come to work and solve their problems with the tool they like best, more power to you.  Let’s all just live and let live in this whole VB / C# debate as it is a pretty much a waste of time.  Really aren’t there better things in life to spend our energies on?


Comments (30)

  1. Rex says:

    I’d actually like to know, for curiosity sake, which parts of the .NET framework are written in VB!

    🙂

  2. Brad_McCabe says:

    Talk to <a href="http://www.panopticoncentral.net/archive/2005/03/02/7762.aspx">Paul Vick</a> as on of the architects here at Microsoft he can give you the details.

  3. Schneider says:

    What did VB got from C++ things like i += 1.

    Operator overloading? Generics? … the list goes on. 🙂

    > Dim as Sam as Man

    You naturally speak and think ‘Dim’? 🙂 I think you need a more sophisticated example than variable declaration to show how a more ‘natural’ syntax can effect developer productivity.

    The final debate is the ‘;’ issue. Writing a program is about defining something very specificially. Any language that uses whitespace (excluding spaces between symbol names of course) means the visual layout of the code becomes part of what the code means!! This is illogical. Code layout/appearance should have nothing to do with code meaning.

  4. wpSlider says:

    Actually, the .NET framework is more like Delphi (since ’92) than VB IMHO.

    If in one day I had to declare 100 variables typing DIM and AS for each and everyone of them would mean an extra 500 keystrokes. Probably more like 700 if you count the spaces.

    If more and more parts of the .NET framework are being written in VB, maybe this is why it’s taking so long to get out the door!

  5. Parikh says:

    Pardon me if i sound like a salesman by the end of this comment, but ever since I began using Visual Assist X with VS.NET 2003, I haven’t looked back. Simply put, this add-in absolutely hits the nail on the head as far as developer productivity. Being a C# dev it always annoyed me how VB.NET got all the cool autocomplete and pretty formatting while we were left out in the cold. Visual Assist X fills the void cleanly and elegantly. Takes a little getting used to but when you’re broken in you’ll wonder how you got by without it.

  6. Don Demsak says:

    Sorry Brad, but since VB.Net has to deal with backward compatibility and C# does not, the VB.Net to IL conversion is never as clean as with C# to IL. If you want to take a good look at a major example of this, check out my recent post on a big bug with the VB.Net Event Implementation and Serialization: http://donxml.com/allthingstechie/archive/2005/04/26/1901.aspx . VB.Net adds an extra field (a mulitcast delegate) to the IL, that C# does not, which forces the serialization engine to try to serialize a class which is just listening to an event and not really part of the object model.

    Don

  7. denny says:

    hey what about this

    drop "DIm" and swap "As" with

    "Is a"

    Buffer Is a String

    MyForm Is a New appForm

    MyData Is a New DataSet

    and so on…

  8. Jeff Parker says:

    ** Chuckles **

    Well of course with a post like this you are going to get a lot of responses. Many Argumentative. Anyway my two cents and thoughts on your post and no I am not going to be argumentative over which is better. I honestly have no problem with you programming in VB or anyone programming in VB.

    I was a VB programmer for 6 years. I am C# now and have been since it was invented and will never go back. I have also programmed in basic, ADA, C, Java, progress, Cobol and out of all of them C# is my favorite language. Another problem is I have a lot of languages roaming around in my head.

    So while I understand that VB is more of an English like language that in it’s own right can make the language extremely confusing. A lot of people from other countries say that English is a very confusing language, which is also why to me VB is a more confusing language. A prime example in the English language is the words there, their, and they’re. These simple confusions exist within VB. At least to my eyes anyway. The Example of this is for and for each loops. The word For is exactly how two specific operations start. Also, I think to me there is too much room and freedom in the VB language that can lead to bad interpretation not only reading it but from the compiler as well. An Example again is the For next loop

    Dim counter As Integer

    For counter = 0 To 10

    Console.WriteLine(counter)

    Next

    Console.WriteLine("No Scope in the loop and the integer advanced to " & counter)

    Is a perfectly legal statement in VB and one that can induce bugs to a great deal, Why because the variable counter is not defined within the scope of the loop hence the scope continues and persist. Now not only does this cause logical errors down the road as a VB program tries to use the variable again which they will because VB 6 coders had to do things like this so they are used to it. Now this is also bad in an application because the variable may not go out of scope for a long time taking up generation 2 garbage collections and quite possibly can even move into generation 3.

    In C# if you even tried something like this you get compiler errors that you must have a new integer for the counting in the loop.

    Now like I said, I do not mind if you write in VB, I wrote in VB for years and on the message boards and in newsgroups I have seen hundreds and thousands of bad mistakes by programmers that just do not know any better they just want it to work. You might be saying to yourself No programmer would do this However not only will it compile Microsoft shows them they can do this in the VB dev center http://msdn.microsoft.com/vbasic/using/understanding/vbasic/default.aspx?pull=/library/en-us/dv_vstechart/html/vbconvisualbasicnet2003languagechanges.asp#vbconvisualbasicnet2003languagechangesanchor2

    Now that page may say later on about the scope of the variables unfortunately a lot of VB developers are also your Mort developers. Elvis and Einstein would hopefully read the rest of the page.

    This very same error can be found in the DotNetNuke Portal V2, don’t know about v3 which is written all in VB. While it may not matter as a web page goes out of scope rather fast. But now you have VB guys as web developers able to develop windows apps and even pocket apps. So knowing this and programming in VB 6 and prior for years, to me VB lends itself to errors more to interpretation and badly written code on a much greater scale. Now that’s not saying you can not write high performing and High quality code. It is just saying a vast majority of the VB code out there has a great deal of problems like this in there because the developer just didn’t know any better that’s the way they had to do it in VB and it still works even though it is a very bad thing. So you can write all the VB code you want, I will never trust it.

    As far as your pinky goes. Writing C# is much like playing a guitar, at first it seems difficult to understand, and your pinky may hurt and not be as strong. In time your pinky gains a great deal of strength, you fingers become more agile and faster. Your notes you pick are not as muddled and you playing becomes elegant.

  9. Adrian Moore says:

    I couldn’t agree with you more. In my opinion what makes languages like C# and C++ hard to read is the number of overloads for the } end-curly. With VB, its much easier to distinguish an End If from an End Select or Next.

    I think another reason Microsoft uses C# for its development is performance. Of the many, real-world application comparisons I’ve done between C# and VB, VB.NET is between 10-20% slower for the same algorithm coded in each language.

  10. Daniel Moth says:

    Wow Brad, how could you miss the point completely? It is not about syntax, statistics or what MSFT uses or who gets paid what etc. It is not about linking to panopticon (all I need to know from there is that "default instances are good" and that is enough to turn me away). It is about features.

    1. Put the features of C# 1.0 and VB.NET side by side. Do the same for C# 2.0 and VB2005. In both cases C# simply has more (heck, half the things VB2005 shouts about are already in C# today)

    2. Future features. We are seeing it with whidbey but it is going to get worst. The languages are taking their own path. I certainly don’t want to be with the one that thinks "My" is a great feature.

    3. Generics. As soon as they came on the scene we knew C# was getting them but VB had to think about it for a while. Luckily the correct decision was made. It could have just as easily gone the other way.

    Why it is about features? Because the fact that both languages target the same framework and run under the CLR means that any other difference traditionally language designers argued about is gone.

    I could have mentioned the attitude problem of the VB team (e.g. catering for backwards compatibility and trying to bring VB3 developers to the platform) but actually all that does is translate itself eventually back to features. The Mort and Elvis story is true and one that makes programming language choice obvious for the professional developer. I think this quote wraps it up nicely:

    “There are experts that use VB and there are non-CS Types that use the C#. We don’t deny they exist; we don’t zero in on those developers, when we design software.”

    <em>quote taken from http://blogs.msdn.com/brad_mccabe/comments/415101.aspx</em&gt;

    Cheers

    Daniel

  11. Daniel Moth says:

    Sorry, that should have been:

    quote taken from http://wesnerm.blogs.com/net_undocumented/2003/09/who_are_you_mor.html

  12. Jeff:

    i tried this code in C#:

    int counter;

    for (counter =0; counter < 10; counter++ )

    {

    Console.WriteLine(counter);

    }

    Console.WriteLine("No Scope in the loop and the integer advanced to " + counter.ToString()) ;

    It ran fine and absolutely no compile errors.

    So seems you have your facts wrong 😉

    Seriously it really amazes me the number of times I see peopel try to say C# is better because of XXX when they really don’t have the facts correct. This thread is jsut one of many real life examples. Me. well I expect developers, software engineers, architects, or just everyday coders to get their facts straight before making a value judgement based on them.

    $0.05

  13. i have to hold an language which we called VB thatz great fun for me thatz why i used to surf ur website .so please send me an important notes on VB,C# and also C,C++.

    thanks

    your keen browser muzammil khan

  14. Richard says:

    Thanks for a fun read. VB is my language of choice because of the natural flow to the syntax. Long live VB!

  15. aljanjaweedi says:

    HI all ..

    I dont know what to say really alot of experinced poeple post their comment here i may be 2 cent tall in VB.net but may be my way of view simplfy what Brad idea .

    First if we take a look to Brad example about vbasic code . we see it’s easy to understand and it’s close to our sence . The idea that i’m from africa ,the english language it’s not my first language and i do learn english at school so it’s not that much good . So when i program with vbasic code it’s easy to me to understand more than C++ code why?! cause C/C++ syntax is more complex . may be i define a variable 100 times using "DIM" that easy for me to have 100 compiler and logical errors on C/C++ so i’ll get lost on my own code !

    Also there are other thing you poeple do not notice. It’s the resources , for me as i speak of any african guy in a country full of civil war which you can see only on TV spec CriSes and diseases we do not have the resources to work with Complex code something just like Egyption old language . Diffcult to learn ,understand also to use . We need something use quickly , work fine and perform wiht less bugs!

    So i think Vbasic is the Language of POORs some kind of help to us (third world poeple spec african coutries) . i know some of you will replay to me and say "hey! that’s not our problem you better drop the keyboard and carry AK74 more than flashing us with ur view" .

    Thanx All and Salute to you Brad!

  16. Why do you spend time trolling C#? The goal of your post is that everyone should get along, yet you spend the vast majority of the post bashing C#. You’re basically adding fuel to the language wars fire that you should be trying to put out. If the VB team is spending all their time talking about C#, C# must be doing something right, huh?

    >>C# is VB with semicolons!

    Have you ever heard of Java? The C# syntax is MUCH more similar to Java then Visual Basic.

    Heck, you could probably argue that VB.NET is closer to Java then VB 6.0. VB 6.0 had a form in a *.frm file. With VB.NET, everything is in a class *.vb (like Java). Creating a VB.NET form requires you to create an instance of a form class the same way Java does rather then the more natural Form1.Show() in VB 6.0. I could go on and on.

    Back to your "C# is VB with semicolons" comment, isn’t saying that C# is VB with semicolons just basically saying that we should all use C#? It’s close enough, why don’t we all just code in C# then? That way you get unsafe code, operator overloading,unsigned types, stronger default type checking, faster performing code (no opcode checks for integer values), XML comments and all the other features that have been in C# since 2001?

    Also, Sharepoint was originally written in VBScript using classic ASP when it originally came out. When those VBscript developers moved their existing code to .NET they chose C#, not VB.NET. Why?

  17. Of course my comment gets submitted before i finished writing and the post now seems like a total troll, I wanted to point out the BS people put on as "advantages" that people give to C#. While I prefer C#, I don’t understand why someone wouldn’t choose the language they are most comfortable with.

    All of the features I pointed are ones that have been used by C# "elitists" as Brad says to show an advantage. In fact they are all available in VB 2005 (and no, C# won’t have default instances AFAIK). Wwhat you see is that the languages have more in common then they did before. I never really understood why someone could choose a language that feels foreign to them, unless they had no choice. The other dumb argument is the "this is what Microsoft creates" argument, with the example like Reporting Services uses C#, therefore I must. I cringe when I hear C# supporters say that because Microsoft creates applications in C#, they must as well. The truth is that C++ is the #1 language at Microsoft and will continue to be. We really don’t give C++ enough credit (Sharepoint’s core components are actually in C++, therefore all Web developers should now write C++!) Why hasn’t everyone said we must now write our applications in C++ because Microsoft does it? The other classic misconception is that no one uses VB.NET inside Microsoft. I think Paul Vick mentioned this before, but VB.NET is used many times more inside Microsoft then VB6 ever was. This inclues the VB team, .NET Framework, Visual Studio, and other products like Commerce Server. The commerce server product has VB, C#, and even some J# in use. Does this mean that everyone should start coding in J#? It’s all about personal preference, yet everyone tries to point out the differences more then similarities. It’s crazy how many times I’ve seen the "superiority" posts based on what Microsoft uses.

    Bottom line, code in the language you want and be happy in the knowledge that your code can interoperate with other languages.

  18. Prakash Sachania says:

    Again, could not agree more with Brad. You validated what I believed. At the end of the day, I might choose C# but not on the fact that it is simple than VB. Whenever, I have to do any POC or small utilities, I go back to VB.

  19. McAkins says:

    Hi All,

    Wanna read the ultimate answer to these questions? Read at the following:

    Rock My World, hail the Machine! An Argument in the Language War

    http://spaces.msn.com/members/mcakins2/#toppage

  20. Jeff Parker says:

    Bill McCarthy,

    Hmm, well you are correct, and you learn something new everyday. I tried probably 4 different ways to get that to work in C# before posting. Which I kept trying to make it look like VB I didn’t think it could be done every way I tried threw a compiler error. However this more proves my point. I got this on first try in VB and looked it up in the VB Dev Center. VB Lends itself to writing bad code. This is the way you used to do it in VB why not keep doing it that way, even though it is wrong. And because I could do it exactly like I used to do it in VB I wonder how many more millions of lines of VB.net are out there doing this. I looked this up in the C# dev center and the example you show is not shown anywhere at all, at least no where I could find it.

  21. Tony Losego says:

    Hi, I agree entirely. I’m a VB fan myself. However, might I suggest, at the very least, using Word or any kind of spell and grammar check. The nitpickers that will gripe you will also pick you apart because of that. You made a few ‘to’ instead of ‘too’ and ‘then’ instead of ‘than’ grammar mistakes as well as some spellings that are also words but not what you meant, i.e. ‘receipt’ instead of ‘recipe’. I’m not faulting you, I understood you entirely, and that’s what’s important, but if you’re going to try to make a point with hypercritical types, you might not want to give then anything to follow a tangent with. Of course, maybe those types would always find a tangent because what you say has merit and they like pressing the ‘;’ key for no reason anyway. 😉 Consider possibly having your editor run through your material before you post.

    Good Luck,

    Tony

  22. Josh D says:

    Right on!

    Nothing is as easy and clearer as VB.

    But remember then the hand writing of your doctor when he hands you out a prescription. It is not in vain. He belongs to an elite group of people who make the world more difficult to merge into and thus conserve their future. Ditto the C, C++, C# and the rest. (Machine language(?), assembly(?)… etc)

    JD

  23. Jeff,

    Give it up man, you’re killing me.. this is too much laughter for my poor old ribs 😉

    You based your assumption on something you ddin’t understand. Now you know that both VB.NET and C# both provide the same features there. And yes Jeff it is a feature as it allows you to determine the count outside of a loop should your code do an early exit. Rather than use a second variable. In tight loops where you are usign early exiting this is a great performance enhancing feature.

    As to you more recent claims, yeh you crack me up. <g> To quote you, it took you 4 attempts to try to achieve that in C# and you couldn’t work it out. You looked in the C# docuemntation and still couldn’t find. Right ? Now considerign both languages support the same features here it sure seems like not only is C# non intuitive for you but also the documentation is lacking.

    Thanks for the laugh 🙂

  24. Bobby says:

    Most of the VB.NET-lovers I know don’t mind using C# if they have to. But everyone I know that has used C# substantially really hates going back to VB.NET.

    Regardless of which language can be proven better than the other, it is a practical matter that the C# community will grow at VB.NET’s expense because VB.NET/C# loyalty conversion seems to be a one-way street. The C# community will continue to be fed from active C/C++/Java communities, whereas VB.NET’s reservoir of VB6 converts is drying-up fast. And, since VB.NET attracts more hobbyists and casual coders it may (unfairly) come to be stigmatized as the "beginner’s .NET language." I think that has already happened to some extent due to the differing reputation of the ancestor communities (VB6 versus C/C++/Java) and is evidenced by an otherwise-unexplainable gap in salaries and billing rates in C#’s favor (according to various recent surveys). Ultimately, the developer community builds a language’s reputation and C# may have begun with the brighter team.

    Even though the two are considered "equal peers" by .NET, once C# gains noticeable market share over VB.NET it’s going to be the only game in town for corporate development (though Microsoft will surely support VB.NET indefinitely). I believe this because, even though Microsoft says "your .NET language is a lifestyle choice," most businesses want to go with the mainstream lifestyle. All of the various businesses I consult for have mandated either VB.NET or C# company-wide because they don’t want to leave that lifestyle choice up to each developer and prefer not to have a mixed-language code base. I mostly see VB.NET chosen when conversion of a large VB6 code base is in the plan.

    Here’s a solution: Add "C# Syntax" and "VB.NET Syntax" to Visual Studio’s "View" menu and let developers switch their entire project between the two anytime they want! (I know… it can’t be done. But some type of conversion utility would be really useful).

    C# and VB.NET guys mostly DO play in the sandbox nicely, and most "go both ways." But even though a language-neutral platform concept is pretty darn cool, a dominant platform language is bound to emerge, as a practical matter, especially for corporate development. If pressed, I’d have to bet on C#.

  25. One of the things I love about Visual Basic is that the syntax is similar to natural language. This basic design make the code so much easier to read and elegant to me. These are often words used to describe C or C#, but beauty is in the eye of the holder

Skip to main content