VB.NET vs C#

S

SStory

I have been having a debate with a coleague at work about C# vs. VB.net.

He is determined that VB is a toy and that C# is so much better on
performance wise.

I told him that I don't believe that and from all that I had seen in
conversations/research, the differences seem to be trivial, yet VB.NET has
more IDE support and is frankly easier to use, unless you are from a C
background in which case C# would be the natural choice.

He said that just in doing an empty loop, that the VB code was a different
from the C# code and underperformed it.

I am kind of aggravated by the prevelent choice of so many people using C#
just out of arrogance, or intimidation by the seemingly "better-than-thou"
attitudes from many from the non-VB camp.

Any comments on this? Links to some numbers/statistics to prove that any
differences would be trivial and that VB would be just as good as C#--and
considering that we are a VB shop--would be the more logical choice for a
rewrite, would also be appreciated.

Thanks,

Shane
 
G

Guest

Jan. 10, 2005

My stance on the issue as a Visual Basic .Net developer is that both
C# and VB are equal. Both, when compiled, run as managed code. They have the
same benefits of isolated execution, suberb exception handling, and very easy
deployment among others. Both can use exceptional techologies such as:
ADO.Net, Xml Web Services, XML, ASP.Net, .Net Remoting, Windows Services, and
Serviced Components. It is my experience that the performance and quality of
an application is not much due to the specific .Net language, but in the
knowledgable application developer. I believe that the difference between the
languages is not in the language itself, but in the developers that implement
the language. In conclusion I believe both are equal although some are a bit
more legible like VB. :)


Joseph MCAD
 
S

Scott M.

There really are no significant performance or functional differences
between the 2 languages. Your colleague is mis-informed about what .NET is
and how it operates at low levels.
 
G

Gerald Hernandez

<SNIP...>
He said that just in doing an empty loop, that the VB code was a different
from the C# code and underperformed it.
<...SNIP>

Tell ya what. Have your colleague step up and provide the code for this
simple empty loop in both C# and VB.Net format. Then post it here. I bet ya
we can prove him wrong.

The main reason VB.Net might underperform C# has everything to do with the
experience of the developer. Improperly constructed code will perform poorly
in any language. Under the hood, if comparably written, they compile to the
same thing.

Gerald
 
B

Bernie Yaeger

Hi,

The old assumption of significant advantage between languages goes back to
the difference between, say, C and VB 3 or 4 and again with C++ and VB5 or
VB6. VB .Net and C# create the same IL instructions almost always, and both
have the same object foundation and efficiencies. There are a few, minor
differences. These differences are about the same as the difference between
Henry James and DH Lawrence; they are not the differences you would see
between Shakespeare and Oscar Wilde, to use some literary metaphors, where
the differences are vast.

HTH,

Bernie Yaeger
 
A

alejandro lapeyre

The differences I see are:

in c# you can use unsafe pointers wich is a must if you are writing routines
for sharpening an image, for example.

in vb you have compliation while you write.

in c# you have easy documentation inside the program, but I cannot comment
how it works because I use vb.

well, in c# you can use overloaded operators.

there are no big differences, it is not a c++ to vb5 debate.

use whatever you feel, i would like that we were able to mix clases in
differents languages in the same project.
 
M

Michael D. Ober

If he's really that concerned about performance, he shouldn't be using any
intermediate compiled language, be it a .NET language, VB Classic, or Java.
He should be writing in straight C or C++ at the most. All languages that
perform intermediate compilation for runtime incur a significant overhead at
runtime to finish the compilation to machine language. This is the tradeoff
required for Object Orientation, true Garbage Collection, and all the other
productivity enhancements we have.

Both C# and VB.Net are simply preprocessors for the .NET intermediate
language and have different constructs for doing the same job. As for such
items as operator overloading, VB.Net is syntactically behind C#, but this
will change with the release of VB and C# 2005 - both languages will be
pretty much equivalent at this point. MS put a lot of effort into C# in
..NET 1.0 and really didn't emphasize the VB language other than to make it
work on .NET. This is why there are still a lot of VB programmers who
haven't upgraded/converted to .NET. VB 2005, which is currently in beta,
corrects this marketing slight.

Mike Ober.
 
G

Guest

From our experience writing converters (VB to C# and C# to VB), there is
virtually no difference in the expressive capability of these languages. It
is purely a matter of style.

C# allows 'unsafe' code - which is frowned upon and almost never used
anyway. VB's IDE features within Visual Studio seem to always be one step
beyond the current C# IDE features, but it's very easy to work with either
language. VB also offers many ways of doing certain things - you may view
this as an advantage or a disadvantage.
 
C

Cor Ligthert

Shane,

Do the following
Go in your IDE to
Tools -> Options -> Project -> VBDefaults
Set there Option Strict (And Explicit) too On

Open a new VBNet Window Application set your Debug mode to Release and start
debug
Open now a new C# Window Application and set agan your Debug mode to Release
and start debug

Go to the explorer and show from both created objects the exe using
bin\obj\release

Probably is than your discussion closed for a long time.
Or maybe you start it than why he is not using VBNet
(Not that it proves something however you will probably the same be suprised
as I was some days ago)

:)

Cor
 
C

Cor Ligthert

Alejandro,
use whatever you feel, i would like that we were able to mix clases in
differents languages in the same project.
That is not any problem, beside you did things as using two classes which
have the same name in uper and lower case in C#.

Just add the C# project in your IDE as a project to the VB project.(third
tab of the reference box)
And use them as any other namespace.

I hope this helps?

Cor
 
C

Cor Ligthert

Bernie,

Can you use next times cars in your methaphors, this is to deep for me.

:)

Cor
 
C

Cor Ligthert

Michael,

In *my* opinion is what you write about intermidiate code an often used
fable and by writing it becomes more and more truth.

Intermidiate code can speed up processes because without intermidiate code
on microprocessors the programs would be fast very huge (It is the same as
making programs without procedures whatever they are in, what in fact
intermidiate code is).

This what you write goes for real small thight to the hardware bounded
programs.

As quick as it becomes business solutions the intermidiate code can speed
up.

However just my thought,

Cor
 
C

Cor Ligthert

I corrected this wrong
Just add the C# project in your IDE as a project to the VB project.(third
tab of the reference box)
And use them as any other namespace.
Just add the C# project in your IDE as a project to the VB project.
Set a reference to it (third tab of the reference box)
And use them as any other namespace.
 
C

Cor Ligthert

Shane,

Forgot even this parts
Do the following
Go in your IDE to
Tools -> Options -> Project -> VBDefaults
Set there Option Strict (And Explicit) too On

The only thing you have to do is this.

Open a new VBNet Window Application set your Debug mode to Release and
start debug
Open now a new C# Window Application and set agan your Debug mode to Release
and start debug

Go to the explorer and show from both created objects the exe using
bin\obj\release

Some weeks ago I wrote that this first part has no direct influence on the
exe and now I make this mistake

stupid me.

Cor
 
C

Chris, Master of All Things Insignificant

Great article Mike. I'd say that one pretty much answers the question.
This paragraph is what sums up the article for those who don't want to read
the whole thing.

"Comparing compilers requires an understanding of the default behavior of
each compiler to ensure that equivalent options are being used. Similar code
segments compiled with dissimilar compiler options can have drastically
different performance characteristics. But as will be shown in the remainder
of this section, Visual Basic .NET code performs identically to C# code when
both are compiled with equivalent options."

Chris
 
B

Bernie Yaeger

Hi Cor,

OK, let's talk about a Lexus v the Acura! But, seriously, Cor, I don't
think there are too many things that are too deep for you!

Bernie
 
C

Cor Ligthert

Chris,

I find the page as well very good.

Did you try what I showed because I see no reaction.

Cor
 
S

Scott M.

Mike, you can "pre-JIT" your IL code with NGEN removing the first paragraph
below.

As for the rest of your comments, I believe that this is just your opinion.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top