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
- Anonymous
May 05, 2005
I'd actually like to know, for curiosity sake, which parts of the .NET framework are written in VB!
:) - Anonymous
May 05, 2005
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. - Anonymous
May 05, 2005
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. - Anonymous
May 05, 2005
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! - Anonymous
May 05, 2005
The comment has been removed - Anonymous
May 05, 2005
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 - Anonymous
May 05, 2005
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... - Anonymous
May 06, 2005
The comment has been removed - Anonymous
May 06, 2005
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. - Anonymous
May 06, 2005
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>
Cheers
Daniel - Anonymous
May 06, 2005
Sorry, that should have been:
quote taken from http://wesnerm.blogs.com/net_undocumented/2003/09/who_are_you_mor.html - Anonymous
May 06, 2005
The comment has been removed - Anonymous
May 06, 2005
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 - Anonymous
May 06, 2005
Thanks for a fun read. VB is my language of choice because of the natural flow to the syntax. Long live VB! - Anonymous
May 06, 2005
The comment has been removed - Anonymous
May 07, 2005
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? - Anonymous
May 07, 2005
The comment has been removed - Anonymous
May 08, 2005
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. - Anonymous
May 08, 2005
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 - Anonymous
May 09, 2005
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. - Anonymous
May 09, 2005
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 - Anonymous
May 10, 2005
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 - Anonymous
May 10, 2005
The comment has been removed - Anonymous
May 13, 2005
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#. - Anonymous
June 06, 2008
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 - Anonymous
June 01, 2009
PingBack from http://woodtvstand.info/story.php?id=7105 - Anonymous
June 08, 2009
PingBack from http://cellulitecreamsite.info/story.php?id=4125 - Anonymous
June 09, 2009
PingBack from http://besteyecreamsite.info/story.php?id=571 - Anonymous
June 13, 2009
PingBack from http://hairgrowthproducts.info/story.php?id=1720