Visual Basic has come a long way between Microsoft's 6.0 release in 1998 and the modern VB.NET available today. Early on, VB was often used for higher-level programming, while the heavy lifting was done with C++. With the rise of object-oriented programming and the coming of the .NET Framework, VB grew to more closely resemble its .NET counterpart, C#. Yet, while the two languages are now nearly identical functionally, a certain stigma against VB remains, said Lance Keene, president of .NET consultancy Keene Systems Inc.
Some veteran VB users only partially agree with Keene's observation about differences between VB and C# today. In this story, they share their views on the VB versus C# debate and come to some conclusions one might not expect from Microsoft loyalists.
In the 1990s, while Microsoft was accumulating a "hodgepodge of tools that didn't work well together," VB did not have a great deal in common with C++, said Keene.
"There was this sentiment in the programming world that real programmers used C++ and college students used Visual Basic," said Keene. "I think some of that persists today – people thinking that VB is not as powerful as C#, and that is not the case."
CLR and the 'grand unification' of .NET
Historically, VB was not as powerful as C++, said Keene.
The language was very popular for its advanced user interface features, he continued, while lower-level programming, like writing hardware drivers, was in the realm of C++. But C++ did have a "clunky way of dealing with screens." In 2002, the .NET Framework arrived, and with it, C# and the Common Language Runtime (CLR) that would bring all .NET languages to equal functional footing.
"When Microsoft did the grand unification, that nice GUI for being able to design and hook screens to code on the back end – that all propagated through the products," Keene said.
With the CLR, VB, C# and other .NET languages are each compiled into a shared Common Intermediate Language (CIL) for runtime. What Microsoft did was pull together all the platform services from its disparate languages into the .NET Framework class library while extracting the syntax into the languages, said Joe Mayo, Microsoft MVP and author of numerous books on Microsoft technologies.
"Now, the languages provide syntax and logic," said Mayo. "But services such as file I/O, networking and much more are in the .NET Framework class library, which is used by all languages." Since all .NET languages now run through the CLR, the features are largely the same across the board.
VB and C# still have their differences
There are still some subtle differences between VB and the more widespread C#. The more obvious differences between C# and VB are syntactical; things like declarations, curly braces and case sensitivity, said Alex Mackey, Microsoft MVP and author of Introducing .NET 4.0 with Visual Studio 2010.
"By default, VB.NET will warn you about overflow operations and C# will not," said Mackey. "VB.NET also allowed you to do some dynamic casts that C# couldn't, and VB.NET has XML literals that I don't think are present in C#."
In the recently released .NET 4.0, Microsoft continued to bring a common base of functionality to the two languages. Mackey said this included the introduction of named and optional parameters to C# and anonymous functions into VB.
Yet despite the functional similarities, a bias still exists against VB, which some say hinders its adoption. This may be because "VB.NET still smells a lot like good ol' VB6," which was not in line with object-oriented programming or service-oriented thinking, said Christian Weyer, co-founder of Germany-based .NET development consultancy thinktecture.
"To me, personally, VB.NET seems to be a little like a neglected child," said Weyer. "Not neglected by the programmers who love it, but maybe a bit neglected by Microsoft." There are many more relevant code sample snippets and sample applications for C#, he said. The same goes for the help topic pages in the Microsoft Developer Network (MSDN). Since April, however, Microsoft has started adding more VB samples to the MSDN Code Gallery.
Some of thinktecture's customers still use VB or a combination of VB and C#, but Weyer said many come to his company when moving from VB to C#. It can be challenging to transition from the VB6 way of thinking to the "different universe of .NET," Weyer said. Because of the similarity in syntax, he continued, developers who simply move from VB6 to VB.NET often still find themselves trapped in the old way of thinking. While C# can be a bit trickier to learn, he said, many find that it offers a cleaner approach to .NET.
When observing how Microsoft has brought parity to both languages over the recent years, one can assume Microsoft will continue to support VB a bit longer, said Rob Sanfilippo, analyst with Directions on Microsoft.
"Perhaps they are employing a strategy of making the two languages similar enough to make it very simple for developers to converge on one language down the road," said Sanfilippo, "and that language would most definitely be C#."