5.1 Visual Basic

Microsoft’s Visual Basic, first introduced in 1991, married the BASIC programming language with a productive integrated development environment. This environment allowed for the visual construction of applications by simply dragging visual “controls” from a toolbox to a form, customizing said controls using attributes (such as the caption of a push button), and attaching BASIC code to events.

The first versions of Visual Basic did not compile to native code, and instead relied on an interpreter which negatively impacted performance. Controls were typically written in C or C++ and packaged as Visual Basic Extensions (VBX), which can be regarded as the components of early Visual Basic. A VBX file was a Windows shared library (a Dynamic-Link Library, or DLL) which used a Visual Basic-specific application programming interface to communicate with its host, and was expected to export a well-defined set of symbols specific to Visual Basic. VBX controls were thus tightly coupled to Microsoft’s product.

Early versions of Visual Basic perfectly exemplified the division between component assemblers and component writers, advocated by some proponents of component technology (discussed in section 1.2). Component assemblers would compose components using the easy-to-learn BASIC language and Visual Basic form designer, and component writers would create components using comparatively complex native languages such as C or C++. The performance cost of interpreting BASIC code is easy to bear in this line of thinking, as performance-critical code is expected to be part of controls written in native code.1

Visual Basic gave rise to a successful component market. Controls ranged from simple visual controls, such as sliders, to full-blown spreadsheet engines and database connectivity tools (Szyperski et al. 2002:351). Despite the lack of a formal specification for Visual Basic components, several vendors created competing products that could act as their hosts (Udell 1994).

The first versions of Visual Basic were the epitome of an environment sporting a first-generation component model, as discussed in Chapter 2. Later versions gained native code generation, and the ability to not only use COM components, but also author them. In fact, 32-bit versions of Visual Basic did not use the VBX component model, and instead based their components on COM, which were dubbed OLE custom controls (OCX) (Szyperski et al. 2002:351). A variation of this technology later came to be known as ActiveX controls, which also served as the plug-in technology for Microsoft’s web browser, Internet Explorer. The current version of Visual Basic has little in common with its predecessors and is fully based on .NET.

Footnotes

  1. Visual Basic’s interpreter did not interpret BASIC code, it interpreted p-code (pseudo code), which can be likened to Java bytecode. Visual Basic 5.0, introduced in 1997, gained the ability to compile to native code. Some versions of Microsoft’s 16-bit C++ compiler were also able to produce p-code. The chief selling point of p-code was not portability, but smaller executable file sizes.