Fog Creek Software
Discussion Board




C# vs. VB.NET for .NET development

Hi all,

We're recently starting an internal project for a client that will likely be .NET based.  The primary focus is on data collection and reporting.  The reports contain a fair amount of numeric calculations.

Any recommendations on whether to use C# or VB.NET?  This is our first 'real' .NET project, and the developers on the project are very experienced with VB6, and they all have worked with Java (some are very experienced with Java).  From a developer perspective, I think the learning curve for either C# or VB.NET will be around the same.

Here are our thoughts about C# vs. VB.NET:
- C# and VB.NET should have identical performance (they're both compiled to IL)
- VB and C# have the same language 'features' (ie VB now has proper error handling and full OO functionality)
- C# does allow pointer manipulation, but we will be avoiding this

Other than syntax differences, it seems to be a dead heat.  The language purists prefer C# (curly braces are more 'hard-core'), but it appears that Visual Studio.NET has better VB support.

What is everyone else using?  Why are you using it?  Our biggest concern is that we pick a language that is orphaned by Microsoft, both in terms of future support and documentation.

Darren
Tuesday, April 16, 2002

From what I've read Microsoft has been using C# for some of it's projects, so you would think they would be favouring more support on that side. This article suggests that C# slightly outperfoms VB.NET - http://builder.com.com/article.jhtml?id=u00820011207adm01.htm

Ben
Tuesday, April 16, 2002

Darren,

Check out:

http://www.discuss.develop.com/dotnet.html

This discussion has been covered there many times already - no need to rehash it here. Needless to say, some of your assumptions are not 100% correct.

Thanks

Matthew John Wills
Tuesday, April 16, 2002

Speed of different .Net implementations are the same in theory but not at all in reality.

Just compare a c++.net app with VB.Net app. The thing is that all compile to IL code however each uses a different compiler and can do different optimisations. Since c++ had the most mature compiler, already before .Net, it could focus soley on optimizing for IL code.

In addition C# was desinged purely for .net so it will "fit" the best.

My suggestion: go with C#

Markus
Tuesday, April 16, 2002

Darren,

I don't think you have to worry about either VB.NET or C# being orphaned anytime soon.

VB is VB.  About a billion people use it.  It's not going away anytime soon.  As for C#, Microsoft claims to have written Visual Studio .NET in C#, so I doubt it's going anywhere, either.

Andy Shyne
Wednesday, April 17, 2002

VS.NET is *not* written in C#. In fact, VS.NET isn't even managed code - it's all old-fasioned win32 api C++.

However, a large part of the .NET framework classes ARE written in C#. So I don't think that C# will get abandoned anytime soon.

Chris Tavares
Wednesday, April 17, 2002

Microsoft wrote some of VS.NET, and a lot of the .NET runtimes, in C#. The VB namespaces are written in VB.NET. The C# and VB.NET compilers, most of the rest of the .NET framework, and most of VS.NET, are written in C++. Since the VS.NET IDE is pretty clearly a direct decendant of the  Interdev 6/J++ 6 IDE (because Microsoft wasn't going to rewriting _everything_ from scratch).

Although I strongly prefer VB.NET, for practical purposes you should decide C# vs. VB.NET issues on...
1) Are your developers more comfortable in C-style languages or VB?
2) Are some of the language-specific features very important to you?

If neither 1 or 2 makes the decision for you, do a few projects in each language and see if you make up your mind.

It's unlikely that either language will be abandoned any time soon, and except in cases where language-specific features matter a lot, the performance of C# and VB.NET apps is very similar.

Dave Rothgery
Wednesday, April 17, 2002

I have read in several places that the CLR is not as language-neutral as is advertised. Though you can have many languages that run in the CLR (as with the Java Virtual Machine), the CLR seems optimized for C#; the further away a language is from C# (e.g., Python), the worse it will perform on the CLR.  I can dig up the links for anyone interested.

Mark
Wednesday, April 17, 2002

If I had to do .NET development, I would definitely choose C# over VB.NET. 

In my opinion, the clarity of code is the major reason why I feel this way.  In VB.NET, there were too many add-ins that made the language a bit too big and also made it really messy.  For example, take a look at the block of code:

Public Sub Whatever()
  Try
      For i = 0 to 10
          With SomeObject
                Do Until myBool = True
                      'Add some code here
                Loop
          End With
      next
  Catch xxxxx as Exception 'Dont know if that's right

  End Try
End Sub

That's probably not the best "messy" example, but I just think it's too cluttered and not as straightforward as C#. Take the C# example:

public void Whatever()
{
    try
    {
        for (i = 0; i < 10; i++)
        {
              while(myBool == true)
              {
                  //some code here.
              }
        }

    }
    catch(Exception e)
    {

    }
}

See, much easier to read and understand.  A personal preference, I guess?

Steve

Steve
Wednesday, April 24, 2002

Of course it is personal preference.  That is the beauty of .NET.  Which language are you more comfortable with is the correct choice.

This is what *I've* started doing for my projects.

Anything UI, web forms (gosh I hate that term) and windows stuff I do in Visual Basic.  I can just code much, much quicker. 

But anytime I do anything like web services or components, I find myself using C# because I just feal like I have more control with things like checked and XML documentation.

I really don't think C# compiling into 10 lines of IL vs VB.NET compiling to 8 is really going to be a deal sealer for most people.  Especially on the UI part of things where most of your bottleneck will probably be waiting for Sally to come back from her coffee break or the database server to return the query. 

Phil Scott
Tuesday, May 07, 2002

Go with C#

Bontaoun Gondard
Wednesday, January 15, 2003

I would have to agree with the notion to use which ever is most comfortable for the programmers. Although I would have to argue that C# is definetly much easier to read and follow, and that I doubt Microsoft would have added a completely new language without just cause, or having optimized it. ;)

Dustin Smith
Wednesday, January 29, 2003

C# for sure, coz....
1) more easy to view and understand...quite clear code
2) BCL is written in C# so optimization is better
3) microsoft supports C# more over VB.net
4) C# has more sucure type safety checking as compared to VB.NET
5) C# is written for .net framework while VB.net is enhanced to work with .net
6) exception handling is similar to java and c++ somewhat so easy learning curve .
7) VB 6.0 programmer shifting  to VB.NET might get into trouble as is way different so learning curve is large.
          what so ever ..the guys who are good at vb should go for vb and those who are pure coder and language lovers will surely go for C# ......UR CHOICE !!!

Muhammad Qasim
Wednesday, May 07, 2003

If you're contemplating VB .Net, go with it.

C# 's intellisense isn't as robust as VB's.

Additionally, I know C# programmers like to think those nifty { } brackets means their code is professional compare to VB. I'm sorry, but I learned programming in Java, and , there really isn't a need for those silly brackets.  Local scope variables exist in VB within Blocks...  I guess it really is a matter of preference.

But while I'm ranting:

Those damn semi colons?  Christ...  perhaps it made sense in C, but that was generations ago.

To me, VB code follows more intuitively with the human mind. 

And for everyone that says VB creates messy code because it implicity declares for you... well, turn Option Strict On... and now you're coding as strictly as C#.


 

Kbeyer
Friday, May 16, 2003

I thought I might as well at least give Borland's C# intellisense its credit... because it really looks up to snuff to MS's VS.Net VB intellisense....

Kbeyer
Friday, May 16, 2003

c# is not good
vb.net is also not good
Use Ms Dos

Sankarettan
Friday, June 20, 2003

If you putt Ref in Hashtable and delegate in vector , c# shows some  triggers but vb.net shows only errors

Pahayan
Friday, June 20, 2003

VB.NET has been found in tests to be significantly slower than C#.  This is probably due to inefficient IL code generation.

jdunlap
Saturday, August 02, 2003

I prefer C# over VB.Net, except for one aspect.

In VB.net, you have the "System.Convert" function (just an example) but you type "system.convert" and it works like a charm.

As I work, I type "system.con" and then use the Tab button so it automatically completes the phrase.

Instead, with C#, I must type "System.con", and it DOES make a difference. Every single damn function and namespace in C# begins with capital letters, so it being case sensitive SUCKS.

I always hated Case Sensitive, and I hate it even more now that I'm a C# programmer :(

Leandro Díaz Guerra
Monday, September 15, 2003

I do believe that C# was born to become the most favourite programming language as it takes advantages of all older languages like C++ or Java ..

Le Minh
Friday, October 03, 2003

i prefer vb.net vs c#
becuase vb's syntax is clearer than every language
vb.net has two advantages:
.net optimizition and trditional vb langugae functions
vb.net>every languages

k_azaryoun@usa.com
Saturday, October 11, 2003

Hey Mark,
                You have stated that the CLR seems to be more optimised for C#
Could you please dig up the links for this

Thanks

Shaunak

Shaunak Pandit
Tuesday, November 04, 2003

C# is best over VB.Net,because

1)It follows C++ heritage,so it is faster than vb.net
2)The operator overloading like small concepts in OOP  is not supported in VB.Net
3)Easly document through XML in C#

PalaniappanMurugappan
Friday, November 21, 2003

The Visual Basic .NET is better because:

1) It's the easiest language ever. That has been a tradition in Visual Basic since the 1.0 version, over other languages like c/c++, java, perl and all that garbage languages.

2) It's the only language with different syntax. All others are painfully similar syntax as c/c++

3) About a million of programmers use Visual Basic 6.0. (Imagine all that people migrating to VB.NET). It will make it the most popular language.

4) Microsoft says "The MOST powerfull tool for building .NET application"

5) C# is about a year and a half, in other hand, Visual Basic is a 60's languages.

6) C# has popularity because is the M$' "new toy". But Visual Basic has almost popularity and is one of the oldest languages.

Enrique Cad
Thursday, December 04, 2003

When I was in school, we learned in Pascal but were taught that C was more "mathematical" and elegant.
Then I started working as a professional developer and found out that C (or any of it's red-headed step children) simply costs far more to write and maintain. Period.  I felt guilty for thinking that, but then realized that we had done our exercises in Pascal because it's strict typing prevented 90% of the mistakes that would otherwise have made our labor in vane. Writing complex applications in inherently hard. Why should I feel guilt for not wanting to make it even harder???

Fortunately, all new languages that I am aware of enforce or allow you to enforce strict typing (Option Strict in VB.Net) along with most other innovations thought up in the last 20 years. As .Net shows, today their isn't that big a difference. BUT, C# is STILL more costly.

Let me first point out that I am starting to develop in C#, and it is a vast improvement over C. Structured error handling is a massive improvement on its own. When my company moves to .Net, I'm going to recomment C# as our standard language specifically because it will keep out the untrained. Still. C# does suck a lot:

1. C style "for" statements are more confusing at best and can be made as complex as the idiot who's code you are trying to fix pleases. Yes, they wrap local variable inside the loop, but we could have done that several other ways--or easily done without it.
2. Curly brackets are harder to read than BEGIN END and other named control block terminators. To be readable, they MUST be formatted exactly right, and control structures cannot span more than a screen.
3. C uses lots of idiotic syntax dreampt up by techno geeks who think programming ought to be more like mathematical notation. ++, +=, *=, :. ::, and a dozen others have no intrinsic meaning in any real-world language, and are cryptic to all but the highly trained. Any 12 year old can read COBOL, BASIC, or PASCAL and understand 95%. Mathematical notation is fine for mathematics. The sum of infinite series and differentiation have no counterparts in normal human experience. These are hard concepts that require complex notation in order to be written in a readable amount of space. None of this applies to computer code. Code, even in this age of multi threaded object orientation is still a set of procedural steps. These steps are simple and only get complex in combination. To make them understandable, we must modularize, encapsulate and above all, spell it all out clearly in human terms. Specialized notation is EXACTLY the WRONG solution for the problem of software complexity.
4. I haven't verified that C# still does this, but in C/C++ MyVar++ and ++MyVar were to different things. C lovers say this is elegent. No, in the context of a loop, this is inconprehensible. The way you reduce cost and mistakes in coding is to minimize what the developer must keep floating in his short-term memory. Most people can only remember 7 otherwise meaningless items at one time (with practice). I figure a good developer might be able to handle about 25 with the phone forwarded and the door nailed shut. I don't have room for "Oh no no, THAT variable gets incremented BEFORE this code runs but THESE get decremented AFTER". Is this a JOKE!! This was a JOKE right!! I'm getting paid to solve problems, not to ponder geek gotchas. If there is no compelling reason not to make the language syntac easier to read--make it easier to read. For God's sake, the radiation does the accuracy of which you are ensuring may one day be your own!
5. Trailing semi colons have no more place in the modern world than manually entered line numbers. BASIC lost that latter years ago, and yet the C hegemony persists with the semi colons. Yes, I no it makes the parser easier to write. Who cares. This makes about as much sense as making people enter equations into a calculator using reverse polish notation---oh I forget--engineers still do that. Hey guess what? Computers are OUR TOOLS, not the other way round.
6. There is no compelling reason for operator overloading to exist. Function overloading is a wonderful thing. But operator overloading, at it's very best, can sometimes be used with increasing support costs. Sure MyPoint+MyPoint is short and sweet, but what exactly does MyArray1*MyArray2 do? Oh, did I mention that MyArray2 is a jagged array of bitmaps and that MyArray1 is a set of rotational transforms? Would Call TransformSpriteImages(ImageArray,Transforms) have ben a bit clearer? Of course it would. Operator overloading is not an evil, only because like variable type suffices (in BASIC) and on the fly declarations, we have the option of not using them. Often touted and a benefit of C/C++/C#, if operator overloading were removed, it would hurt the world not one little bit.
7. Finnally. Case sensitivity. Brought to use by the same people who though it made sense to call mainframe programmers in the middle of the night because the multi million dollar VMS operating system could not be bothered to allocate it's own datafiles. Only a low grade moron would make a language case sensitive. To a human being, DamnTheTorpedoes and damnTheTorpedoes mean the same thing. To expect a person to slow down and press the space bar on every blessed word in an object model as complex as that of the .Net framework is so shortsighted, to maniacle, so perverse, that whatever nit wit thought it up will surely roast in a hell shared only with the mental midgets to delighted in their own geekiness that they thought it a good idea to copy this lunacy in Java, C#, and God only can imagine what else. Shame on you all. May you all drink drain cleaner and die.

Still, I like C# fine. It's fun enough, and I'll program in whatever they tell me to. But when I'm footing the bill, it'll be anything but C, C++, C#, Java, Jscript or any of their ilk.

Cregg Hardwick
Thursday, December 04, 2003

I don't like C# for the following reasons:
1. Matching curly brackets is a hassel, particularly after inserting/deleting nested blocks.
2. VB code is more readable. You know exactly where a block begins and ends.
3. Case-sensitivity in C#. Is c# different from C#!
4. You need to put ; at the end of each line.
5. VB.Net has better intelli-sense.

I think people coming from VB6 background would like to use VB.NET. Those from C/C++ who like the curly brackets and are obsessed with them will favor C#.  The learning curve favors programmers with VB6 experience because they are already used to the event-driven programming model of .Net.

Ashok Garg
Friday, December 05, 2003

Hello, I'm a VB programmer for 7 years now, and I have to admit that you cannot be totaly true when saying that VB is better than c# or c# is better than vb.net. I know VB and VB.net but i discovered c# and its as powerfull as I need. A true programmer don't need to know a language. You must have a good capacity of analysis. This point is the only one that separate a coder from a programmer. I have worked on many project in many languages, Cobol, C/C++, VB, JAVA, C#, Javascript Server side (Hyperwave). I didn't encountered any problem with all these languages because all my project were analyse very well.

I know it's more interesting to code in a language that seems to be easy to manipulate for many reasons, but it's not a good reason to compare many languages on there own specification. Its not a war ;-) Do your best and have fun...

I consider i'am a lucky man because I love working on IT technologies, it's my job, my hobby, and i'm quite good doing it.

I'am actually working on a IDE in .NET (mixing VB.net and C#) The result will be a free IDE for .net project...  made with no difference between the languages used...

Bye everybody and don't forget : Knowledge has no limit...

Max Lamenace
Monday, December 08, 2003

I have to agree with Max.  I started off programming in vb and with the introduction of .NET I instinctively wanted to stay with VB.NET, but after doing a lot of analysis found that C# has quite a few more powerful commands and features that VB.NET lacks.  A lot of people have said that the intellisense in C# is worse than that in VB.NET but that is only because of the case-sensitivity.  Whichever language you use, it is possible to organize it so that it is easy to read so that's not really the issue.  I still do some projects in VB.NET while the majority of my projects are coded in C#.  Each language has it's strengths and weakness and the main advantage that VB.NET has over C# is when interacting with some Microsoft products it has simpler and quicker instructions.  Aside from that I've found C# to be a lot more powerful as a programming language but they are extremely similar and even if you've been programming for years you should be able to adapt to putting a semicolon at the end of a line, because one of the most important aspects of programming is the fact that it is constantly changing and if you can't change with different languages then you'll encounter many more problems in the future.

Christian Beach
Tuesday, December 09, 2003

On using C# or VB.NET:
Perhaps you should think of it  more like having certain tools for certain jobs. The C# language is similar to java in most aspects, and inherits good algorithmic practices from C and C++.
VB.NET is and probably always will be a shortcut tool when you need to quickly make a certain type of simple app. or modification.
let's just say that you could because of the Common Language Specification use both for different parts of your applications
Of course that can be a bitch to read if it is not well documented...

USR@BLANK.#*$
Friday, April 02, 2004

In my opinion it takes a lot of time to learn OOP's strengths... especially if you have a strong procedural mindset.

Your average BASIC user from the past 15 years is going to have a procedural mind-set.  So... exactly when did VB go OO compared to C?  The answer to that question should make you think about what baggage you're going to get in your IT shop.

If you pick:

C#:  you get a majority of OO coders who may have started in C but spent some time with C++ and maybe even Java.  In fact, as a Java programmer I've spent time with C++ and Delphi.

VB.Net: you get a majority of procedural programmers who are now struggling to stay relevant in the workplace (read: they have to learn OOP).  You also get the COBOL rejects who had to learn the next most popular procedural language when Y2K was over.  (Don't even start about COBOL OO).

People might balk at the "C" origin languages... but they've had the most success in moving to OO within the last 10 years (Delphi being the exception -- but then, not a lot of people use it).

By the time the procedural coders get up-to-speed with VB.Net, all us OO coders who've taken our OO lumps will have already learned what OOP is (and isn't)... and moved onto AOP.

rmch
Sunday, July 18, 2004

*  Recent Topics

*  Fog Creek Home