1. Computing

VB.NET versus Java versus C#

By October 7, 2008

Follow me on:

"Adrian" wrote in to ask:

"Some people tell me VB.NET is bound to disappear, and that C# or Java are better. What do you recommend?"

I haven't answered this question in a while, so here's my point of view.

Back in the days of VB6, there was much more of a case to be made about "VB" versus "C" but today, everything is different. Back then, a lot of what the computer could do was 'hidden' from the VB programmer to reduce the complexity of programming Windows enough to make it a practical reality. It's doubtful that Windows itself would have been successful without VB to reduce the cost of developing an application enough for business to afford it. But some programmers insisted that they needed to get 'next to the hardware' anyway for speed or the implementation of low level functions (like communications ports or individual monitor pixels). It's questionable how often this was REALLY a requirement but since managers tended to simply not understand the issue, programmers often got their way in spite of business realities.

But that was then and this is now.

Today, the issue of Java versus VB and C# versus VB are two different questions. They have seperate pro's and con's. Let's look at them individually.

Java versus VB

This is actually more a question of Java versus .NET, not VB. Java is a complex, but very powerful, programming environment controlled by Sun. In my opinion, Java has both less functionality and more complex requirements than .NET. Some of the reason is due to the fact that .NET is simply a more recent development and Microsoft took advantage of more advanced understanding of what worked and what didn't. (Much of it learned because Java pioneered the way, but that's life in the big city.)

At the same time, Microsoft has recently pushed out the frontiers of programming with initiatives like WPF (Windows Presentation Foundation - the basis of Vista Aero graphics which gives you vector based and hardware accelerated graphics), WCF (Windows Communication Foundation - again, used in Vista, but destined for much greater things because it was designed with the Web at the core) and WF (Workflow Foundation - if this takes off, it will be incredible, but it's actually advanced beyond the needs of today's business).

Sun simply doesn't have the infrastructure to match this kind of "Apollo Project" scale of development. Some pretty amazing things are being done in Java, but they're being done by the customers, not by Sun. If you plan on inventing your own wheel, go with Java. If you want the resources of a mega-corporation behind you, go with .NET. There are pro's and con's of living inside the garden walls rather than being free and on your own. Choose wisely.

C# versus VB

This is a much more difficult choice. Today, VB.NET and C#.NET both compile to exactly the same intermediate language and use exactly the same Framework libraries. In most important respects, they are identical. As you note, the main difference is in syntax. C# syntax looks like this:

for (int i = 1; (i <= 10); 
i = (i + 2)) 
{
    // Do this
}

VB syntax looks like this:

For i As Integer = 1 To 10 Step 2
   'Do this
Next

Pick the one that seems easiest to code and understand.

There are a few language differences today (more than there were when .NET was introduced, actually). But most of them favor VB. For example, the C# development team has chosen not to implement the "My" namespace in C#. (But you can use it anyway by simply importing the Microsoft.VisualBasic library into your C# project.) And there are features in the VB.NET implementation of Microsoft's new LINQ, such as XML literals, that aren't in C#. ("Nullable Types" - a feature in C# that isn't in the current version of VB - will be in VB.NET 9.0.) So they aren't identical in functionality, but they're very close.

The one clear advantage that C# has is that there are more books and articles written using C# as a basis. I simply don't understand this and it seems illogical to me. But since I review a lot of books, I can't deny it. What I can say is that there are plenty of books and articles for both. I doubt that you will ever run out of reading material with either one.

The bottom line is that both VB.NET and C#.NET are great development environments. Given a free choice, I would (and have) picked VB. But the decision factor in the 'real world' is likely to be the language that your employer chooses.

Comments
October 7, 2008 at 8:46 pm
(1) finalizer says:

Why did you write the C# version of the loop by so unpractical and unusual way? In Java and in C# I would write it so:

for (int i = 1; i <= 10; i += 2) {
// Do this
}

Then why you think it’s more complicated then your VB version?

October 8, 2008 at 2:08 am
(2) Nix says:

Java has both less functionality and more complex requirements than .NET.???

What is the alternative for Enterprise development in .Net??? (say EJB, Connectors and Authentication and Authorization).

I’ll say you want total control of your application go with Java. How easy it is to create custom grids, custom components in .Net?? It is as complex as in Java. And very few people knows it, but still they will claim that they are “.NET Developers”

October 8, 2008 at 8:17 am
(3) gsrk says:

By saying “There are pro’s and con’s of living inside the garden walls rather than being free and on your own. Choose wisely.”
I dont understand if the supports VB or Java! Well, if I hear to Dan’s words, I would choose to be free and on my own, and I will choose Java.

October 8, 2008 at 10:12 am
(4) visualbasic says:

First, let me say, “Welcome to About Visual Basic” to my new friends here. I’m glad to see that my blog attracted a few comments.

Second, having seen flame wars before, I know enough not to get involved in one. So I’m not going to respond to things that are clearly value judgements. The goal of the blog was simply to outline some of the choices, not to dictate a conclusion. My bottom line was, “choose wisely”. I have no problem with someone who does not make the same choices that I do.

But I will reply to questions that are not value loaded arguments.

finalizer asked, “Why did you write the C# version of the loop by so unpractical and unusual way?”

I didn’t. I simply ran it through a translation web page and copied the result. But, apart from saving a few keystrokes, I don’t see much difference. (And I’ll freely admit, VB normally requires more keystrokes.)

But I also didn’t say it was “more complicated”. I said, “Pick the one that seems easiest to code and understand.” If that’s C# for you, then great. I have no problem with that.

October 9, 2008 at 5:47 am
(5) Lennie says:

Hi! Normally I don’t agree or join language wars but: I programmed for 4 years in Java, VB (VB.net and VB 6), C++ and C#, PHP etc. The fact is that each language have advantages and disavandages, yes the .Net framework is more solid than the Java lib but Java is cross-platform to portable devices etc… VB is easy to code since it hide you from the details of the framework where with C# its more “C++ system style” of coding where its not so abstract like VB…. the point that i’m making is that you all even the guide can go on how bad one language is over another etc but hey, b glad that we don’t live in the days of Assembler since that was bad! A language is a tool, use the tool that you prefer (its your own personal opnion) and have knowledge in, for example: I will not go write a complete website in a week using Ruby on Rails since I don’t know it but it doesn’t mean its a good tool. Use the tool that suite the task and hand and what you prefer… damm if you want to use Lisp then go for it!

October 9, 2008 at 1:04 pm
(6) Bob says:

Nice article – spoken like a genuine moron.

And what’s up with the convoluted code? Have you ever compiled a non VB program in your life? Another clueless moron blogging away.

October 12, 2008 at 11:15 am
(7) programmer says:

You don’t understand why there are so many C# books. You think the employer will choose the language.

Managers tended to simply not understand the issue, programmers (Bob) get their way in spite of business realities.

C# is after all the new language.

October 13, 2008 at 10:09 am
(8) jazzydonald says:

Whateverer the language someone choose to me doesnt matter, but what matters the most is that one(programmer) should choose a language that will enable him/her to be able to accomplish his task at hand. If can use cobol today and accomplish my tasks the way i wanted it whats the problem with that???

Also for a certain languge (Like c#) to have so many articles, books,sample code on the entire internet, books library etc, doesnt mean it is the best language. problaby its beacuse its a new language and people wanted us all to get an idea of it, compared to vb which was there since 90′s.

But the bottom line is, just like leenie and bob mabbut said, the choice is yours and choose wisely depending on your prefarences but they are all good languages that we can use to accomplish our task.

If you feel your are not very comfortable with the symbols,curly brackets etc then go with vb if you are go with c# or java.

October 13, 2008 at 10:33 am
(9) visualbasic says:

“If I can use Cobol today and accomplish my tasks the way I wanted it whats the problem with that???”

No problem. I used Cobol for twenty years and there were a lot of great systems built using it.

However …

For whatever reason, virtually no structured, object oriented code was written using Cobol. It’s not impossible to do. It’s just that nobody did it. The language itself must have something to do with that.

October 14, 2008 at 10:53 pm
(10) Velu says:

I had used all these languages for real projects. My ranking:
1) Java
2) C#
3) VB6
4) VB.NET

October 24, 2008 at 1:45 pm
(11) Fabiano says:

I agree with you, nice article.

November 4, 2008 at 8:49 am
(12) TheMan says:

The c# code you posted as a comparison to VB code showed that you don’t have a clue what you’re talking about Dan. My best advice to you is to stick to what you know (which is nothing probably) rather than exposing yourself as a know-nothing pillock like you have here.

November 4, 2008 at 10:56 am
(13) visualbasic says:

Thanks for your comment; and thanks for adding to the hitcount total at About Visual Basic. All contributions are appreciated.

I’ve left your message on the site as the best representation of this point of view.

December 9, 2008 at 10:04 pm
(14) TongGA says:

Just an article bias to vb.net. Apparently the author never use java for enterprise application development.

December 10, 2008 at 10:45 am
(15) visualbasic says:

The author has never been part of the Java development team, but the author has certainly been a part of projects where both languages were in use.

Java is a great development environment just as .NET is. The factors that should go into a choice transcend personal preference and include past investment (does the company have the skills to enjoy a competitive advantage in one technology or the other); specific business requirements (both languages have technology advantages in particular areas); and possibly extra support that might be available from vendors. These days, Sun just isn’t able to offer much since their own business isn’t experiencing much joy.

December 13, 2008 at 9:42 pm
(16) Nonono says:

Hi everyone!

December 28, 2008 at 3:11 pm
(17) Random says:

What about c++? C++ should be the best (as long as you really know how to code in c++)

December 29, 2008 at 12:56 pm
(18) visualbasic says:

First, the original question didn’t include C++, so I didn’t include it in the answer.

But C++ is clearly one of the major development environments. Large, highly technical companies rely on it for their most critical core components.

C++ is a complete superset of C, so most of the pro’s and con’s of C also apply to C++. This is especially true in a comparison of C++ to VB.NET. The ‘C’ family of languages allows (in fact, requires) a lot more attention to memory management issues like and pointers and references. .NET (that is, “managed” code) is fundamentally designed to avoid requiring programmers to deal with those issues because experience has clearly shown that failing to do this right is how most of the really nasty bugs and security holes get into code.

Your point that, “as long as you really know how to code in C++” is right on target. Most of the criticism of C and C++ is based on the fact that code produced by programmers who have not taken the considerable time and effort to learn the skills required for C and C++ end up producing code that is inferior to the much more automated code produced by higher level languages like VB.NET.

The argument is often made that only C and C++ can produce the highly optomized code necessary for writing things like video games, core server functions, and database management systems. With the evolution of better compilers for .NET and Java, that is less and less true. J.P.Lewis and Ulrich Neumann of the Computer Graphics and Immersive Technology Lab at the
University of Southern California write in “Performance of Java versus C++” (http://www.idiom.com/~zilla/Computer/javaCbenchmark.html) provide lab quality proof that “Java performance on numerical code is comparable to that of C++.”

The reason some large organizations still use C and C++ probably has more to do with the large investment they have made over the years in a foundation of C++ code that they can’t afford to rewrite than in any inherent advantage of C++ as a language. But some people continue to ‘believe’ in C and C++ anyway. In the words of Lewis and Neumann, “it is possible that no amount of data will alter peoples’ beliefs, and that in actuality these ‘speed beliefs’ probably have little to do with java, garbage collection, or the otherwise stated subject. Our answer probably lies somewhere in sociology or psychology. Programmers, despite their professed appreciation of logical thought, are not immune to a kind of mythology.”

I think that’s especially true of the comparison of VB to other languages. VB offers a commonsense syntax that is fast and easy to learn and results in exceptional programmer productivity. That, combined with the superior performance and security features of .NET, create a development environment that is hard to beat. But many programmers can’t get their head out of the previous century where VB 6 really did lack object oriented features and the ability to program some types of critical, core processes.

Personally, I’m very willing to admit that C++ might be the better language for some types of programming. The real flame throwing C++ haters are the C programmers. A great example is none other than Linus Torvalds, legendary inventor of Linux. In a reply to someone advocating C++ rather than C in a public forum (http://lwn.net/Articles/249460/), Torvalds writes:

—————————

*YOU* are full of bullshit.

C++ is a horrible language. It’s made more horrible by the fact that a lot of substandard programmers use it, to the point where it’s much much easier to generate total and utter crap with it. Quite frankly, even if the choice of C were to do *nothing* but keep the C++ programmers out, that in itself would be a huge reason to use C.

In other words: the choice of C is the only sane choice.

—————————

Remember, this is Torvalds writing, not me.

January 7, 2009 at 1:13 pm
(19) dawg3294 says:

They’re all very similar to me. If you’re a good programmer, you’ll do ok with any of those languages. I’d recommend doing a hotjobs/dice.com search for each language in your neighborhood. Then just go with whichever language has the most jobs in your area. It’s no use getting all high-and-mighty about a programming language if there are no jobs.

January 9, 2009 at 7:37 pm
(20) Antonio says:

good article. – here are my two cents:
I am a programmer for one of Canada’s largest marketing companies.

Me and the team constantly update the company system or create new applications for the company or for our customers.
Everything we do is in VB.NET and SQL Server.
The company is a million dollar business and growing strong despite the economic recession.
Thanks to VB.NET and SQL Server I have a nice house, my wonderful car and I can afford to enjoy a good life.

To all the C# and Java fanatics out there – Since your language is “better” than VB.NET then we should expect that you can do much more with it and that the language itself can do much more for you as well. having said that I guess you are now in possesion of a very nice private jet and living by the beach, right?

January 15, 2009 at 6:37 pm
(21) BlackBerry Developer says:

I love language wars where nerds fight over which language
is better especially when not one of them can speak
proper English. I have worked in numerous programming
environments after receiving a PhD from Stanford. I’ve
used just about everything from C, perl, Python, C++,
Java, vb, vb.net, c#, delphi, whatever… Each language
presented its own challenges as well as pros and cons.
The fact of the matter is that language is meaningless,
its all about implementation and knowledge of concepts.
The language is just a tool to achieve your result.

If you are unable or unwilling to use a certain language
or platform perhaps you are in the wrong industry. Learning
new languages is wonderful and essential for any programmer
worth his/her salt. Remember its not the arrows its the Indian.

January 15, 2009 at 8:52 pm
(22) Macu says:

Agreed 100% with Antonio and with Blackberry developer.
If you are a good programmer you will do good no matter the language you use.
At school our of my programming teacher make us learn algorithms and leaves the language to be our own choice.
I have seen good code written in VB.NET running faster that its C# counterpart. Many enterprise applications are built upon VB.NET and they really rock.

January 16, 2009 at 10:57 am
(23) visualbasic says:

I agree as well. I’d like to highlight the fact that the Blackberry Developer made these points with very good English. I always consider that to be a plus for any comment.

Although you can create software systems in just about any language, the time and cost will vary widely depending on a number of factors such as the nature of the problem, the previous technology investments of the organization, and the native features of the language itself. (That last factor was listed last deliberately.)

Visual Basic has shown itself to be an excellent language for creating systems with great programmer productivity. When the other factors don’t argue against it, Visual Basic is an excellent choice for developers looking for the optimum environment in a competitive world.

August 25, 2009 at 2:09 am
(24) Pierre says:

A real-life example can make things clearer:

TrustLeap G-WAN is a Web Application Server which is faster (in user-mode) than IIS 7.0 (in the kernel). G-WAN ANSI C89 (‘edit & play’) scripts are 5x faster than ASP.Net C#.

G-WAN is up to 38x faster than Apache.
G-WAN is up to 25x faster than Nginx.

G-WAN was started in C++ and then converted to C because of the ‘++’ overhead. The gain was not only in footprint (currently 106 KB), but also in performances (~180%).

If you want to know what makes C++ so bad, just try virtual inheritance and virtual functions, and then compare the machine code générated by the C++ compiler with a clean C implementation of the same features (the C++ code is twice larger -and slower).

Conclusion: if you are targeting performances then you can use C++ as long as you write C code compiled with a C++ compiler.

In my humble opinion, Linus is a programmer that make systems work, and Bjarne is a programmer that uses the systems created by programmers like Linus.

There should be no surprise that system users are less technically inclined than system engineers.

September 16, 2009 at 10:41 pm
(25) VeteranProg says:

IMHO:

Winner of the language syntax:
C#

Winner of the mature framework, 3rd party support, security:
Java

Winner of the IDE:
.NET

October 7, 2009 at 1:57 am
(26) griever says:

the author is biased. he is too much on his own programming language.. not a good judge. he doesn’t know what he is saying.. damn, C# also has LINQ and XML in in C# forms.. and the judge proved he is stupid enough to tell that Java has less functionality compared to VB.net?

VB.net in long form is Visual Basic. NET – not Basic eh?

VB.NET, if I ain’t mistaken, has no exceptions compared to Java or C#.

even babies can use VB.NET, so if your vain enough, use VB.NET.^^

anyway, this is a visual basic site, I should have said good things bout VB, .. so I say .

October 7, 2009 at 2:00 am
(27) griever says:

i don’t think c++ should be included here, c# is the successor of c++, means c# is wider.

October 7, 2009 at 10:44 am
(28) Dan Mabbutt says:

Thanks for your comments.

I don’t believe it’s necessary for me to respond. Thanks for understanding.

January 7, 2010 at 10:03 am
(29) Rob says:

C# is not its successor C# is nothing to do with C++.
C++ is not ‘bad’ due to virtual inheritance/virtual functions.

What is bad is you choosing the wrong tool for the job. A language sacrificing performance for features is really not a difficult concept. If you were trying to make a program run as fast as possible you should never of even considered C++.

March 23, 2010 at 6:36 pm
(30) Maunil says:

Somebody here said that who has made custom grids in .net, the important part is that i dont require to do so, my need is to complete the project in time, my client doesnt need me to prove that i know how to make custom grids, they want the systems on time, so lets not make custom grids and add cost to the project when i get them readymade,
when something is already available why to make them from scratch, just reuse them,

Working with .NET is easy and cost effective,
Using .NET small companies get a boost atleast this thing is proved…???

Atleast the time for which i have worked on .NET and Java, i can summerize that rapid development can not be done using Java, and .NET is best at that…!!!

August 15, 2010 at 2:05 am
(31) A Programmer says:

I feel like Visual Basic is fifth generation language where you focus on the goal and you do not need to know any thing regarding the computer and how this thing work, the syntax is very meaningful (not to the computer and what acctualy happen there) but to the person using it. However, it is not suitable for profesional use or for serous programmers, since it is very verbose and u have to type alot and that is so boring to some people. So, basicly, if you are a serious programmer, csharp is the way to go because it is practical and it is close to C/C++ which of its important and other languages, it is also faster in developing because imagine you are reading a book full of english and another book that uses signs you know which one will you read faster, its is the second one ofcourse. Visual Basic is only and exclusivly for hobbyist and I think that is the resone why microsoft made it.

August 15, 2010 at 6:26 pm
(32) visualbasic says:

Thanks for your opinion, “A Programmer”.

However …

With Intellisense, nobody types complete statements anyway, in VB or C#. They both take about the same number of keystrokes. You can do anything in VB that you can do in C# (and vice versa) and they compile down to the same .NET code. (And, neither one is “close to C/C++”. Statement syntax is nothing compared to understanding the underlying Framework.)

So … why is it again that it’s “only and exclusivly for hobbyist” (sic) ?

I’m not throwing any rocks at C#. It’s a fine language for the same reasons VB is a fine language. It depends on what makes sense for you.

August 22, 2010 at 10:57 pm
(33) LANGUAGE_ NEUTERED says:

Hay All. First of all we have to show respect to Mr.VisualBasic as he is the Engineer of this thread and we are all users i.e He is the Linus Trovalds of this debate!

Next, like he said, you go which ever way you like. No one is asking you what you use. It does not matter to me what you use. I used VB, VB.net, Java, C++, C#, PHP, and Python. Every 2 years I add a language to my portfolio and yes I am a millionaire.

Also, VB and C# are both RAD tools. It simply depends on your background before the .NET Revolution weather you were a vb person or a C++/C person. Also, C# and VB.Net code compile to the exact same MSIL code. And they both have access to the CLR and the Base Class Libraries. They both got LINQ which has changed the way I code and now with the Entity framework, things are beautiful. Java progress has ceased since the departure of some of its masterminds who are now involved in XQuery and Python with the Google App Engine.

VB.Net is not for hobbyists. My Company’s (Where I Work) net worth is over 320 Million $ US and we use many languages but we rely on Microsoft as a backbone. Our projects are coded in 75% VB.NET (ASP.Net + WPF + Silverlight) , 15% C#, 10% JAVASCRIPT + CGI + CSS.
For databases, we use, MySQL, SQL SERVER 2008 DATACENTER, ORACLE, and some of the legacy systmes on db2.

SSSSSSSOOOOOOOO, make a long story short, in the end, all you eat, weather steak or peanuts, ice cream or caviar, becomes sh** and leaves your corpse, hence, any code you write, weather VB.Net, Lisp, Smalltalk, Jython, IronRuby, XQuery, J++, Interdev, …. BECOMES MACHINE LANGUAGE! NOW CODE THAT AND SHUT YOUR YAP!!

All the respect to Mr.VB for starting this session. Hopefully, this will end it! ;-)

July 22, 2011 at 9:14 am
(34) TheBlogEnder says:

I’m only leaving this comment to unfulfil LANGUAGE NEUTERED’s “All the respect to Mr.VB for starting this session.
Hopefully, this will end it!” request and make sure I end it instead…hahahahahaha…but its really sad to see that people would read such a cultured, diplomatic article and still foolishly take offence at it…its really daft indeed…Mr VB!!! Yuz the Man.

May 22, 2012 at 1:40 am
(35) Another vb.net programmer says:

I seriously think people are misjudging vb.net, and how can people be so blind to the fact that c# and vb.net are almost the same thing. So if any one is going to attack vb.net they might as well attach c# as well. Or is their some bias towards languages that are not c style.

vb and vb.net are now two completely different things. Don’t know the difference? then look it up. Most of the articles I see referring to vb.net are well outdated(2006,2007 etc.) they are therefore referring to earlier versions of vb.net or probably vb, vb.net has now reached a stage where programmers can make just about any software a Java or c# programmer can make.

So here are some things to note:
-If your relying on here/say then your probably not very wise.
-If your using vb to determine the capabilities of vb.net then your probably not wise at all.
-If you drop your language(and its a very good language namely, vb.net) and pick up another because of word on the streets(in our case the web) then you’re a backstabber,a person who gives up/ loses hope easily and have a higher probability of giving up on your apps easily or develop apps filled with nonsense —hence your not fit to be a programmer.

Choosing a language is mainly about what suites you best. I would admit that if your planning on applying for a Job in the future then you should be selective in what programming language to use. However if your creating apps that you want to share online –where ever by what ever means– then choose a language that you know you’ll be comfortable with. A good way to decide is to try out each language until you find “the one”.

May 31, 2012 at 6:35 am
(36) Marta says:

I read blogs such as this one to get ammunition to use against my Manager’s constant attempts to denigrate my VB skills in relation to my colleague’s C# skills.
As my background was in VB6 I naturally progressed to using VB.NET and have nothing against any other language. My mantra is always the same “Show me something that my colleagues have done in C#.NET that I could not have done in VB.NET “. His answer is always “Customers want c# skills” ???
On a tangent, I speak 4 languages and each has its own nuances. The skill in speaking those languages is my appreciation of what constitutes a language, the etymology of its words and how it is used, not the particular languages I speak.
I know this is an old article and an old argument but it is still relevant. If anyone has any good ideas on how I can end my manager’s pestering once and for all I would be grateful.

May 31, 2012 at 6:38 pm
(37) visualbasic says:

Good luck! But quite frankly, I’ve found it to be a bad policy to go against management. They’re often wrong, but they’re always in charge. (And I say this after a career of banging my own head against a stone wall.)

However …

Did you see my recent blog where I noticed that Kaspersky seems to be using VB.NET to investigate the new international virus, Flame, that seems to be the latest weapon in the battle between the West and Iran?

Iran Virus Detection … in VB!!

Evidently, Kaspersky likes VB.NET well enough.

Leave a Comment

Line and paragraph breaks are automatic. Some HTML allowed: <a href="" title="">, <b>, <i>, <strike>
  1. About.com
  2. Computing
  3. Visual Basic

©2014 About.com. All rights reserved.