Visual Basic

A programming language and IDE developed by Microsoft

Describes Microsoft's Visual Basic programming environment.


Introduction

Visual Basic (VB) is a programming language developed by Microsoft for both hobbyist and business use. It is called Basic because it derives from a version of BASIC (Beginner's all-purpose symbolic instruction code), a language designed in the sixties for educational use. It is called Visual because programmers can assemble applications by dragging components onto a design surface and editing them with a mouse. It has been hugely popular since its introduction in 1991 and remains widely used, though in the business world it has fallen behind C#, another Microsoft language. It is primarily a language for Microsoft Windows, though there are third-party versions for other platforms with varying degrees of compatibility.

Visual Basic .NET, the most widely used version today, builds applications for Microsoft's .NET Framework, which means they can run (subject to compatibility issues) wherever the .NET Framework is installed. This can include both desktop and mobile versions of Windows. Most recently, Microsoft has implemented .NET in a browser plug-in called Silverlight which enables applications to run within web pages on the Apple Mac as well as on Windows. Visual Basic applications are usually developed using Microsoft's Visual Studio, though it is possible to use other editors.

Another version of VB, called VB Script, is designed for small utilities and runs without .NET, either within web pages or on the Windows desktop. VB Script is little used on the Web, because it only runs in Internet Explorer, but is popular for scripting administrative tasks.

Visual Basic for Applications (VBA) is a third incarnation, used as a scripting language for Microsoft Office and in some third-party products.
 
The Basic language was intended to be English-like and therefore easy for non-specialists to learn. For example, the following code runs in early versions of Visual Basic (up to 6):
 
Let a = 6
Let b = 3
Print a + b
 
Today you might write something like this:
 
Dim a = 6
Dim b = 3
Console.Write(a + b)

which perhaps illustrates how VB has become less English-like and more like other programming languages over the years. Nevertheless, it is more forgiving than most languages, it is not case-sensitive, and it avoids the heavy use of punctuation like semi-colons and braces that makes C and C# look intimidating to beginners.
 

Influence on software development

Visual Basic has been influential in several ways. It was not the first visual development environment, but its success firmly established the idea, which is now seen in IDEs including Delphi, C#, and non-Windows tools such as NetBeans 5.x and later.
 
Unfortunately VB's influence has not all been positive. One of the problems is that its IDE positively encourages developers to intermingle business logic with presentation code. For example, arguably a block of code that handles a button click should do no more than call out to some other procedure, but in VB applications it is not uncommon to see extensive application code residing in click handlers. This weakness was mostly carried over to Visual Studio and remains there today.
 
Visual Basic code is almost too easy to write, but coming up with a high-quality, robust and maintainable application design is just as hard in VB as in any other language. In consequence, probably an above-average number of VB applications lack these characteristics.
 
Another VB problem is that its limitations and quirks required workarounds, particularly in the early versions before .NET. Some of these involve calling out to the Windows API, while others are because of peculiarities in the language. See memorable articles such as Verity Stob's Thirteen Ways to Loathe VB and Bring your Hatchet by Bruce McKinney.
 

History

Visual Basic 1: 1991

Visual Basic was based on a prototype called first Tripod and then Ruby, developed outside Microsoft by Alan Cooper. Microsoft purchased Ruby in 1988, and released Visual Basic 1 in 1991. Prior to its release, developing applications for Windows was complex and took many lines of program code; VB was therefore successful even though VB applications ran more slowly than those written in C or C++. Another key feature was its extensibility, thought VBX (Visual Basic Extension) add-ons.

Visual Basic 2: 1992

The second version of Visual Basic introduced features for professional programmers. Microsoft was realising that this was not just a toy. In particular, it included ODBC for database access.

Visual Basic for DOS: 1992

VB for DOS had little to do with VB for Windows, apart from some common ancestry. The product updated Microsoft's QuickBASIC Professional Development System with a new library that enabled use of a character-based windowing system, not entirely unlike the one in FoxPro for DOS. It was a promising product, but somewhat buggy, and Microsoft infuriated its users by never releasing an update.

Visual Basic 3: 1993

In the third version, Microsoft bundled the JET database engine, the same one used by Microsoft Access. The Standard Edition allowed database access through the built-in Data Control, whereas the Profession Edition allowed the programmer to access the database engine using a rich and powerful object model.  Since many business applications use databases, this was a major advance, and VB3 was the most successful iteration yet.

Visual Basic 4: 1995

This was an awkward release for Microsoft. Despite its popularity, VB had some problems. It was 16-bit only, and lacked support for object orientation, seen as an essential feature of modern programming languages. VB4 was released in both 16-bit and 32-bit versions, and also introduced classes, giving VB object orientation though without inheritance. VB4 also replaced the VBX with a new type of add-on called OCX (OLE Control Extension), based on COM, Microsoft's component programming model. Although these were important advances, the release was marred by the greater complexity of VB4, the awkwardness of having two versions, the pain of migrating from VBX to OCX, and a somewhat buggy initial release.

Visual Basic 5: 1997

Around this time some Windows developers were looking enviously at Borland's Delphi, a programming tool with a language almost as easy as VB (Borland's Object Pascal), but which compiled to native code for fast execution. Microsoft responded by included native code compilation in VB5, though it was never quite a fast as Delphi. VB5 also enabled programmers to create OCX controls in VB itself. This was a strong release, and shook off the problems which spoilt VB4.  VB5 also was the first edition of Visual Basic that did not support compilation to 16-bit executables.

Visual Basic 6: 1998

Something of a so-what release, VB6 brought in new features like web classes, but there was little that was essential compared to VB5. Developers did not realise at the time that this was the last of its line. Because of that, VB6 is still in use today, especially for maintaining existing applications.

Visual Basic .NET: 2002

Visual Basic .NET was the first version to target the .NET Framework. Microsoft made considerable effort to make the language close to VB6, but it was not fully compatible. There were simply too many differences between COM and .NET, and between the old GUI (Graphical Use Interface) components and the new Windows Forms library in .NET. It was, in effect, a new language; and although VB .NET was not exactly a failure, it caused difficulty for exsiting developers with no easy way to migrate their existing code. A further issue was the substantial runtime requirements in VB .NET, which complicated deployment and reduced performance. Incompatible, slower: it was no wonder that the VB community complained. Some concluded that they might as well use C#, a new language developed specifically for .NET.
On the positive side, VB .NET introduced full object orientation for the first time, cleaned up many anomalies in the language, and with hindsight .NET Framework compatibility brought many benefits. The ability to run VB on the Mac via Silverlight, for example, would not have come about without it. Contrast Visual FoxPro, another Microsoft programming language, which stuck with its native-code runtime and is now near-obsolete.

Visual Basic 2005

From now on, the history of VB is tied closely to the history of the .NET Framework. Even so, the language has continued to evolve. In VB5, Visual Basic caught up with C#, with features like the Using statement for freeing resources automatically. It also supports generic types and nullable types. Microsoft also brought back a VB6 feature which developers had missed: the ability to modify code while debugging, called Edit and Continue.

Visual Basic 2008

In VB 2008, the language is updated to support Microsoft's innovations in language-integrated query (LINQ). This introduces keywords such as Select, Where, From and Order By, for querying data natively within the language. Other features, mostly related to LINQ, include extension methods, type inference, anonymous types and Lambda Expressions. While these features are welcome, they also illustrate how far VB has strayed from its roots as a simple language for beginners. Arguably the original spirit of VB is now found in fledgling projects like PopFly, a visual programming language for the Web.
 

Resources

Visual Basic Express - free VB edition from Microsoft
Visual Basic official home page
Open source Visual Basic for Mono (cross-platform)

Comments

Visual Basic external inks

It would be great if you can place some links to useful visual basic websites.

Last edited Aug 4, 2008 2:46 AM
Report abusive comment

VBA - Visual Basic for Applications

A comment about Visual Basic for Applications (VBA) would be appropriate at this point. Microsoft has included visual basic in their office applications with extensions specific to each particular application. For example, MS Access VBA has extensions relative to data and MS Excel to spreadsheets. VBA is the background code in the Macros of office applications and one can edit the VBA code by editing a macro (as in MS Excel) or saving a macro as a module (as in MS Access). This gives a great deal of added functionality to MS Office applications.

By: http://www.dataplus-svc.com

Last edited Jul 26, 2008 8:33 PM
Report abusive comment

Untitled

Some more syntax examples, along with a more detailed breakdown of the language features (separate from the history) would be nice.

Last edited Jul 24, 2008 8:55 AM
Report abusive comment
Version: 17
Versions
Last edited: Aug 4, 2008 5:03 AM.

Reviews

    tim anderson also wrote

    Knol translations

    Categories

    Based on community consensus.

    Activity for this knol

    This week:

    18pageviews

    Totals:

    2038pageviews
    7comments