Developer .NET UPDATE--Visual Basic .NET vs. Visual C# .NET--May 7, 2004

This Issue Sponsored By

DevConnections: Fall Dates

In This Issue

1. Developer .NET Perspectives

  • The Horse Race Between Visual Basic .NET and Visual C# .NET
  • 2. Resource

  • Featured Thread: Advice Needed on How to Populate a .NET Form
  • 3. New and Improved

  • Data Navigation Control for WinForms

  • Developer .NET Perspectives

    by Bill Sheldon, [email protected]

  • The Horse Race Between Visual Basic .NET and Visual C# .NET
  • Visual Studio .NET provides four English-based languages: Visual Basic .NET, Visual C# .NET, Visual C++ .NET, and Visual J# .NET. One question that inevitably comes up when discussing the Windows .NET Framework is which programming language is the best to use. Because all four languages build on a common framework and run in a common environment, they support many of the same capabilities. However, of the four languages, only Visual Basic .NET and Visual C# .NET provide access to the Windows .NET Compact Framework and Visual Studio Tools for the Microsoft Office System. Thus, for the majority of developers, it's a two-horse race between Visual Basic .NET and Visual C# .NET.

    When you're trying to decide between Visual Basic .NET and Visual C# .NET, one piece of advice you might hear is that if you're familiar with Visual Basic (VB) 6.0 or Visual Basic for Applications (VBA), you should use Visual Basic .NET. Similarly, if you're familiar with C++, J++, or Java, you should use Visual C# .NET. However, in reality, the decision typically isn't that simple. Sometimes, people don't have significant experience with any development language. Other times, an organization is attempting to have everyone use the same language, but people in that organization are familiar with different languages.

    So what factors should you take into account when choosing a language? As I just noted, Visual Basic .NET and Visual C# .NET have many of the same features, so the selection of a language almost always de-evolves into a discussion of which you like better. Accordingly, no single feature present in one language will make this decision cut and dried. Thus, you need to look at the overall characteristics of each language you're considering.

    So, let's take a look at a way of categorizing languages. Many years ago, back when I was still a junior engineer, some really smart people decided to categorize programming languages into various generations based on key characteristics. The idea is that as programming languages evolve from machine-specific language closer to natural language, they're advancing through generations.

    The machine code associated with commands at the processor level is an example of a first-generation language (1GL). Second-generation languages (2GLs) consist of low-level languages, such as Assembly. You can write tight, fast-running code with 1GLs and 2GLs, but it comes at a high price. Writing and maintaining the code is time-consuming because of the languages' complexity.

    Unlike 2GLs, 3GLs consist of higher-level command languages that you compile down to 1GL code (i.e., machine code). C++ is an excellent example of a 3GL. C++ starts to bridge the gap from machine-oriented programming to human-oriented programming. You can use C++ to write code that addresses low-level system details, but C++ provides much higher-level system access. However, the ability to get at the lowest levels of the OS means that C++ is a complex implementation language, which makes it a dark horse in the programming-language race.

    If a language is classified as 4GL, it's closer to natural language than machine-specific language. Although you write commands that are closer to sentences, you have only limited access to the underlying system details. T-SQL and VB are commonly cited examples of a 4GL. Even before the .NET Framework, VB abstracted away the machine-specific details such as pointers, memory addresses, and memory management. As with natural language, VB isn't case sensitive.

    A 4GL tends to make programmers more productive, but at a cost: A 4GL tends to generate code that's generic or, in an interpretive environment, might not compile down to machine code, which causes the resulting application to consume more system resources.

    Languages in the last category, 5GL, concentrate less on words and more on visual elements. The idea is that instead of worrying about language and syntax, you develop solutions by manipulating components that are available as part of your environment. Whitehorse, which will debut with Visual Studio 2005 (formerly code-named Whidbey), will be a 5GL development engine.

    So where does Visual Basic .NET and Visual C# .NET fit in this programming-language scale? Visual Basic .NET is a 4GL, whereas Visual C# .NET is a 3+GL because Visual C# .NET keeps some of the lower-level workings exposed. These low-level capabilities, however, add to the complexity of using that language to design and implement projects. And those complexities exist regardless of whether or not a project implements low-level details. So, when compared with Visual Basic .NET, Visual C# .NET doesn't provide the same level of productivity.

    The bottom line is that the small differences in complexity between Visual C# .NET and Visual Basic .NET add up. Thus, Visual Basic .NET is a better implementation choice for most business projects, especially given that the .NET environment lets Visual Basic .NET run with the same speed and efficiency as the more complex alternatives. To this end, let's discuss a related consideration: the language compiler. The Visual Basic .NET compiler is a generation ahead of the Visual C# .NET compiler.

    The Visual Basic .NET team started with what was essentially a mature compiler (i.e., the VB 6.0 compiler). To adapt the VB 6.0 compiler to Visual Basic .NET, the team mainly concentrated on updating the syntax and runtime environment.

    The advantage of having a mature compiler from which to build is reflected in many of the Visual Basic .NET compiler's features. For example, with the Visual Basic .NET compiler, you can compile as you type. And in Visual Studio 2005, the Visual Basic .NET compiler will have edit-and-resume capability, which means that you can edit and continue your execution of your compiled code. These features are in the Visual Basic .NET compiler before the Visual C# .NET compiler because even though portions of the Visual Basic .NET compilation engine had to be reworked, the underlying ideas were already present in the compiler's design.

    I'm not saying that Visual Basic .NET's compiler and generation level make it superior to the other languages in every situation. However, in the end, the same productivity-oriented features that made VB the most popular development language in the world make Visual Basic .NET the best choice for the majority of projects today. Thus, whether you're starting out with .NET as your first programming environment (so existing familiarity with a given syntax isn't a factor) or whether you're attempting to select a language that lets your organization be more productive, I recommend that you use Visual Basic .NET. If you'd like more information about programming languages, check out these links:

    • For an overview of programming language generations, go to,,sid9_gci211502,00.html
    • For a basic discussion of how Microsoft sees each .NET language's role, check out
    • For a basic feature comparison between Visual Basic .NET and Visual C# .NET, go to
    • For an introduction to Whitehorse, I recommend watching MSDN TV at

    Finally, as part of this commentary, I should disclose that I'm a contributing author to "Professional VB.NET" from Wrox. However, that contribution has in no way influenced my analysis. I've worked with all types of languages, including Visual C++ .NET and Visual C# NET. In fact prior to the release of .NET I spent more time working with C++ then working with VB. The fact is that, when all else is equal, Visual Basic .NET is a better selection for productivity reasons. As developers, our job isn't to work at the lowest level but to create solutions and be productive--goals that Visual Basic .NET is uniquely positioned to help us accomplish.

    Sponsor: DevConnections: Fall Dates

    DevConnections is coming to Las Vegas on November 7 - 10. Register early and you'll get access to all three conferences for one price: Microsoft ASP.NET Connections, Visual Studio Connections, and SQL Server Magazine Connections. Register now to get the best early bird discount. Call 800-438-6720 or 203-268-3204.

    (brought to you by SQL Server Magazine)

  • Announcing the 2004 SQL Server Magazine Innovator Awards!

  • It's that time of year again! SQL Server Magazine is organizing its 3rd annual Innovator Awards Program. If you've created an innovative SQL Server solution or enhanced a program or system feature to improve performance, you qualify to enter this awards program. Fill out an entry form today to get the recognition you deserve. Click here:

  • On the Go? SQL Server Magazine Has a Portable Resource!

  • Introducing version 8 of the SQL Server Magazine Master CD. Subscribe today and get portable, high-speed access to all articles, code, tips, tricks, and expertise published in SQL Server Magazine and T-SQL Solutions. The CD features articles by such experts as Brian Moran and Kimberly L. Tripp. Subscribe now:


  • Featured Thread: Advice Needed on How to Populate a .NET Form
  • Expert forum member Craig HB needs advice on how to populate a WinForm or Web form with employee-related details. If you can help, go to the following URL:

    Events Central
    (A complete Web and live events directory brought to you by Windows & .NET Magazine: )

  • Register now for Microsoft Tech Ed 2004
  • Optimize your skills at Tech Ed 2004 -- May 23-28, 2004 in San Diego, CA -- the definitive Microsoft conference for building, deploying, securing and managing connected solutions. Explore Microsoft's latest developer technologies. Network and make lasting connections with peers. Sharpen your skills on products such as Visual Studio .NET and the .NET Framework. Register now.

    New and Improved

  • Data Navigation Control for WinForms
  • dtrt ag announced the release of dtrt.NavBarWin, a rapid application development (RAD) control that lets developers navigate through a data collection. Built for the Microsoft Visual Studio .NET developing environment, you can use dtrt.NavBarWin with any Visual Studio .NET-compatible language. The WinForms data navigation control works with data sets, views, collections, and objects that implement the IList interface. A novice can easily start working with the control; an expert can fully exploit all configuration, customization, and development features. Available for $31.30, dtrt.NavBarWin works on systems running Windows .NET Framework 1.0 or later and requires 3.1MB of free hard disk space. Contact dtrt ag at (41) (0) 56-640-0361 or AllSal[email protected]

    Contact Us

  • About Developer .NET Perspectives -- [email protected]
  • About the newsletter -- [email protected]
  • About technical questions --
  • About product news -- [email protected]
  • About your subscription -- [email protected]
  • About sponsoring an UPDATE -- contact Kate Silvertooth ([email protected])
  • This email newsletter is brought to you by Windows & .NET Magazine, the leading publication for IT professionals deploying Windows and related technologies. Subscribe today.

    View the Windows & .NET Magazine Privacy policy at

    Windows & .NET Magazine, a division of Penton Media, Inc.
    221 East 29th Street, Loveland, CO 80538
    Attention: Customer Service Department

    Copyright 2004, Penton Media, Inc. All Rights Reserved.

    Hide comments


    • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

    Plain text

    • No HTML tags allowed.
    • Web page addresses and e-mail addresses turn into links automatically.
    • Lines and paragraphs break automatically.