tags:

views:

122

answers:

1

I came across VB.NET and Java Comparison, which is an old article. Both languages have evolved much since then. Please compare and contrast VB.NET and Java.

A: 

There are two aspects to comparing VB.NET and Java: (1) The languages themselves, and (2) the virtual machine environment and system libraries.

In my opinion, VB.NET as a language is simply inferior to Java as a language. On the other hand, C# as a language is comparable to Java, with each language having strengths and weaknesses.

With regard to the runtime environments and system libraries, the JVM and Java libraries are intended to work equally well on a large number of platforms (Windows, Linux/Unix, Mac OS X, etc), whereas the CLR and .NET libraries are intended to work best (or only) on Windows, with lip-service paid to cross-platform development.

If your intent is to develop only for Windows, with no intent to move your application beyond that environment, then by all means, use .NET (and within .NET, use C# not VB.NET). If you want to build an application that will work beyond Windows, then choose Java.

Craig Trader
First, VB.Net and C# are the same, since under the hood they both are converted to IL, so this is a red herring. The difference in .Net between C# and VB are mostly syntactical (there are exceptions).
Wade73
Those syntactical distinctions (and exceptions) are why VB.Net and C# are different languages. That they both compile down to the same Intermediary Language, running on the CLR is precisely WHY I distinguished between the languages and the virtual machine/libraries.
Craig Trader
@Wade73: Boo, Nemerle and F# all also compile to IL, yet they're nothing like VB.NET / C#
Mauricio Scheffer
@W. Craig Trader: Why do you say VB.NET is "simply" inferior to Java? For example, VB.NET has type inference and closures, Java does not. Comparing languages is *hard* and plainly saying that *x* is inferior than *y* (for any *x* and *y*) without any reasoning just doesn't work.
Mauricio Scheffer
@Mauricio, there is nowhere near enough space in a comment to cover what I don't like about VB.NET as compared to Java (or C#), but it's pretty well covered by the fact that VB.NET isn't really it's own language. It's MS Basic with stuff added to make it Visual Basic, and with even more stuff added all in an attempt to make it equal to C#, mostly in a lame attempt to be able to claim (for all of the VB programmers) that they'd be able to still code in VB for .NET. By the time MS was done, the syntax and hacks that were added to VB end up making Perl look good to me. VB.NET has no soul.
Craig Trader
@Mauricio, Type Inference is a fine thing in a loosely-typed, loosely-coupled scripting language, where duck typing rules. In a strongly typed language, type inference is syntactical sugar for lazy programmers who can't be bothered to declare the type of a variable when they use it. As for closures, they are a fine way to reduce a complicated task to a single line, while eliminating clarity and readability. And that's my subjective, argumentative, opinion. <grin>
Craig Trader
@W. Craig Trader: in that line of thought I could just as well argue that C# is a clone of Java, which in turn is just a simplification of C++, which in turn was born as a hack to implement OO over plain C. My point is, very few languages are actually conceived from scratch. Even those that are, get a lot of influence from many other languages.
Mauricio Scheffer
@W. Craig Trader: Re type inference: try haskell, ocaml, F#. Re closures: try any FP language.
Mauricio Scheffer
BTW: I'm no fan of VB.NET either :-) But I *do* appreciate that MS keeps improving the language so when I *have* to use it (e.g. legacy code) I can apply modern programming techniques.
Mauricio Scheffer
@Mauricio, I agree that all languages are influenced by those that come before. On the other hand, while Java has some roots in C++ (and more in Objective-C), it's not trying to be backwards-compatible with either of them. VB.NET has way too many 'features' that exist merely to be backwards-compatible, all the way back to Quick Basic. Given a choice between VB.NET and C# to do new development, I wouldn't give VB.NET any thought at all.
Craig Trader
@Mauricio, Object COBOL and Visual COBOL are waiting for you as well ;-)
Craig Trader
@W. Believe what you want. VB.Net is not VB 6. VB got a bad name due to people trying to push it beyond it's capabilities, but then again you can program poorly in any language, see thedailywtf.com for many examples. Each language serves it purpose and VB is easier to read, maintain, and use to build line of business applications. No chasing curly braces or guessing a statement's purpose.
Wade73
@Mauricio In VB and C# the code is written with very similar syntax and often the only difference is the semicolon. I can easily translate many C# statements into VB, I would say there is very little difference.
Wade73
@Wade73: yup, I'm not arguing that. I'm saying that being compiled to IL is no reason for any two languages to be nearly the same. IL and the CLR are flexible enough to support different programming paradigms.
Mauricio Scheffer
@Mauricio I would agree with that and so how you get to the IL doesn't matter, which was my point.
Wade73
@Wade73: but that's exactly the opposite of what I'm saying. It *does* matter how you get to IL, and a lot. Coding in F# or Boo is a very different deal than coding in VB.Net/C#.
Mauricio Scheffer
@Mauricio My only point is the IL. If what I write and you write turns into the same IL, then how you coded it means nothing. When I call messagebox.show and you do it, same IL. I understand that F# is function programming and there is a lot of differences in what you write and what it outputs as IL. The point I am trying to make is that they all output IL. My IL and your IL are exactly the same language.
Wade73
@Wade, that makes as much sense as saying that since all compilers on Windows generate x86 machine code, all compiled languages on Windows are the same. What you should be saying is that all of the .NET languages target the CLR and the .NET runtime libraries, so they share a common environment.
Craig Trader
That is taking it to the extreme and not what I meant. Implicit in talking about IL is the fact that it targets the CLR and .Net runtime libraries. What is it that VB.Net can't do that C# can that makes C# so much better? My feeling is that your preference for it is due to syntax and it's perceived superiority, not any real difference in the languages abilities.
Wade73
@Wade, Syntax is a huge factor in a language's usefulness and success. Look at LISP, a language that is very good at doing a great many things, but for the most part only fanatics use it, because no one else wants to put up with all of the parentheses. Some programmers refuse to use Python because it requires you to indent your code. Others don't like C/C++/C# because they use braces. You talk about compiling to IL, but no one wants to code in IL, anymore than they want to code in assembly language, if they can avoid it.
Craig Trader
@Wade, why would I want to code in VB.NET, using a syntax that has been hacked together to maintain the pretense of compatibility with Dartmouth Basic from the 60s, when I can choose a different language (C#) that provides the same capabilities (and more) without all of that baggage? (And yes, I've coded in Dartmouth Basic, Apple Basic, MS Basic in ROM, MS Basic for CP/M, Quick Basic, Visual Basic, and Visual Basic for Applications.) I use the languages I use because their syntax provides a balance between conciseness and clarity. And that's my subjective, argumentative, opinion. <grin>
Craig Trader
First, my repeated reference to IL is that most of the code you type will compile to the same IL for the code I write. Nothing more and I agree, only crazies would want to be dragged into that. Maybe I would have avoided this by just saying, "choose the language that fits your style since C# and VB.Net are not all that different." Just my equally subjective opinion. <grin>
Wade73