I've just finished to read with interest the last
post of Maurice de Beijer
after his speaking called "Visual Basic or C# battle".
The main argument is always the same story: what are the advantages of using
C# vs VB.NET or vice-versa?
Maurice posts some interesting points of analysis:
When Visual Basic has an edge:
- Office/VSTO development.
The Office object model was created with
optional parameters, a feature of VBA, in mind and makes heavy use of it. As
Visual Basic supports this it has an advantage over C#, unless of course you
like typing Type.Missing :-)
- COM interop with older applications.
And in this case I am
specifically referring to COM interop without a complete type library,
something common in VB6 or Visual FoxPro. This is where Option Explicit Off is
a great helper and time saver.
When C# has the edge:
- Very large projects.
In these cases the complete background
compilation of the VB IDE and related updating of the Error List window might
become a drag. That said I have not worked on a Visual Studio 2005 project
where I experienced this.
- Unmanaged code.
While there is no speed difference between C# and
VB when it comes down to managed code C# leaves the option of unmanaged code
open. Unmanaged code makes direct memory manipulation possible, something we
showed in a graphics demo where the unmanaged C# version was more than 20
times faster than either the managed C# or VB code.
I can agree to this conclusion except for point 1 on the C# side. Maybe I've
not totally understood what's the problem that Maurice wants to put in evidence
here, but on my experience there's not a real difference between a big
project developed with C# and the same big project developed with VB.NET.
This comes only from my experience, but for a big project totally written
with managed code, using C# or VB.NET is quite the same in terms of
performances, I've never see differences. What could change the behaviour (in
favour of C#) is the using of unmanaged code, but this is well summarized on
point 2 of Maurice's analysis.
Another point of discussion is about the skills story: why a C# developer
must be more skilled than a VB.NET developer? Where is written this?
Maurice says: "The C# team focuses in correctness while the VB team is
more focused on RAD". Surely, VB.NET is more RAD than C# for its nature,
but I think that a big project must be well written in all cases, no matters
what's the language chosen, otherwise you'll never have good performances and
good results. Who works on a big project must work with attention, must take
scalability into a big consideration, must architect its solution with attention
and intelligence, and all these aspects are independent of the language you'll
choose to develop your solution.
So, I really can't see a real winner on this (eternal) battle of C# vs.
VB.NET. I think that one of the power of .NET is this new freedom to choose the
language you prefer: develop with the language you prefer but develop with
intelligence! 