VB.NET: The Ugly Duckling

Comments 0

Share to social media

One of the greatest pleasures of programming in C# is that wonderful, giddy, feeling of superiority one has over VB.NET programmers. In C#, one has a vague awareness that what one is doing has elegance and style. It must be the effect of the curly braces. By contrast, VB.NET steadfastly maintains its status as the ‘ugly duckling’.

Is this really justified? After all, a routine that is programmed in any of the.NET Framework languages will be compiled to almost the same IL opcode sequence and the JIT-compiler will produce very similar CPU instructions: Therefore, VB.NET is likely to be as fast as C# or any other .NET Framework language. It is also just as versatile: after all, Microsoft used it to write the Silverlight JavaScript compiler, and the current VBx (VB 10) compiler was written in VB.NET.

The negative perception is due, in part, to the fact that the first ‘DotNet’ version, Visual Basic.NET 7, gave every appearance of having been slapped together in a big hurry. It had fewer features than VB 6, and abandoned VB’s greatest asset: that of being a dynamic language for rapid application development. Despite this, Visual Basic became the most popular .NET language (Heffner 2005, Forrester Research) with over twice as many users as C#. Visual Basic Express Edition is by far the most popular download and all indications from postings in blogs and forums is that Visual Basic is the most popular of the DotNet languages. Of course, there was already a large reservoir of skilled VB programmers in the industry, but given that by 2005 most VB programmers had long ago added C# to their skill-set, its continued popularity indicates that VB has an appeal all of its own.

VB 8 quietly and steadily closed the gap on C# and VB 9, the current version, introduced all sorts of useful features such as XML literals, XML axis properties, and Smart Query expressions. The forthcoming version, Visual Basic .NET 10.0 (VBx), could be the release that finally cures its inferiority complex once and for all. It uses the Dynamic Language Runtime (DLR) so can be used for application scripting, just like VBScript and VBA. It also allows dynamic methods and type generation. Use of the DLR makes late’ or ‘dynamic’ binding almost as fast as static binding, and fully returns VB to the immediacy that VB 6 had as a quick way to get scripting done.

We all love Java and its cousin C#, of course, but once the Dynamic Language Runtime, and the corresponding Da Vinci Machine, are perfected, I suspect the language debate will change. Both the Java Virtual Machine and .NET have, so far, constricted the effective choice of development languages because they didn’t support dynamically-typed languages such as Python and Ruby. Once this is fixed, it will result in greater choice and allow the programmer to choose the language that best fits the task in hand, rather than the one best honed to the inherent limitations of the framework.

Cheers,

Tony.

About the author

Tony Davis

See Profile

Tony Davis is an Editor with Red Gate Software, based in Cambridge (UK), specializing in databases, and especially SQL Server. He edits articles and writes editorials for both the Simple-talk.com and SQLServerCentral.com websites and newsletters, with a combined audience of over 1.5 million subscribers. You can sample his short-form writing at either his Simple-Talk.com blog or his SQLServerCentral.com author page.

As the editor behind most of the SQL Server books published by Red Gate, he spends much of his time helping others express what they know about SQL Server. He is also the lead author of the book, SQL Server Transaction Log Management.

In his spare time, he enjoys running, football, contemporary fiction and real ale.