Recent Articles



































Visual Basic



         


Visual Basic (VB) is an event driven programming language and associated development environment, created by Microsoft. It is derived heavily from BASIC. VB enables Rapid Application Development (RAD) of graphical user interface (GUI) applications; allows easy access to databases using DAO, RDO, or ADO; and makes it easy to create ActiveX controls. A moderately skilled programmer can quickly put together a simple business application using components provided with Visual Basic.

Many derivative languages also exist:

[Top]

Language features

VB was designed to be usable by all programmers, whether novice or expert. Forms are created using drag and drop techniques. A tools pallet can be used to place controls (e.g., text boxes, buttons, etc.) on the form. Controls have attributes and event handlers associated with them. Default values are provided when the control is created, but may be changed by the programmer. Many attribute values can be modified during run time based on user actions or changes in the environment, providing a dynamic application. For example, code can be inserted into the Form resize event handler to reposition a control so that it remains centered on the form, expands to fill up the form, etc. By inserting code into the event handler for a keypress in a text box, the program can automatically translate the case of the text being entered, or even prevent certain characters from being inserted.

A VB application can consist of one or more windows, or a single window that contains child windows. Dialog boxes with less functionality (e.g., no maximize/minimize control) can be used to provide pop-up capabilities. Controls provide the basic functionality of the application, while programmers can insert additional logic within the appropriate event handlers. For example, a drop-down combination box will automatically display its list and allow the user to select any element. An eEvent handler is called when an item is selected, which can then execute additional code created by the programmer to perform some action based on which element was selected.

The language is garbage collected, has a large library of utility objects, and has basic object oriented support. Unlike many other programming languages, VB is not case sensitive. String comparisons can be performed with case sensitivity, if so desired.

Visual Basic spawned the first commercially viable reusable component market. There are thousands of 3rd party components available today from hundreds of vendors. Visual Basic makes it easy to build, deploy, use, and reuse components, however it is not as easy to use forms created for one application with another, due to the global nature of the language.

[Top]

Controversy

Visual Basic is a controversial language; many programmers have strong feelings regarding the quality of Visual Basic. VB was designed to be a simple language, and many features found in languages like C++, Java and C# are not found in VB. In the interest of convenience and rapid development, some features like compile time type-checking and variable declaration can be turned off. This leads to programmers praising VB for how simple it is to use, but also leads to frustration when programmers realize they need to use a feature that has been removed.

Many critics of Visual Basic explain that the simple nature of Visual Basic is harmful in the long run. First, it is often used to teach programming due to its simplicity, but learning to program in Visual Basic does not introduce the programmer to many useful programming techniques and constructs. This often leads to unintelligible code and workarounds. Second, allowing the programmer to turn off many of the checks and warnings that a compiler implements may lead to difficulties in finding bugs.

But many of the proponents of Visual Basic explain that the simple nature of Visual Basic is its main strength, allowing very rapid application development to experienced VB coders and a very slight learning curve for programmers coming from other languages. Additionally, VB programs can easily be integrated with databases, a common requirement.

Visual Basic is also a conglomerate of language features and syntax, with less consistency, but more tolerance, than many modern programming languages. Many language features like GoSub, On Error, and declaring the type of a variable by the last character in the name (i.e. str$) are legacies from VB's BASIC roots, and are included for backward-compatibility. Other characteristics include variable and subroutine names that are not case sensitive, and an underscore "_" must be used for a statement to span multiple lines. Some Visual Basic programmers perceive these as strengths needed to avoid case-sensitive compiler errors, and line-termination characters some languages require, usually semicolons.

The language continues to attract much praise and criticism, and it continues to cater to a large base of users and developers.

[Top]

Programming constructs not present in Visual Basic

[Top]

Behaviors present in Visual Basic

VB has the following uncommon traits:

[Top]

Visual Basic and VB.NET

Visual Basic.NET is a backwards incompatible upgrade of Visual Basic to Microsoft's .NET platform. Many of the above criticisms have been addressed with many of the missing features added. VB.NET has support for threading, advanced object oriented code, Try-Catch-Finally blocks, and zero based arrays. Many new features (mainly from the .NET Framework) have also appeared, like remoting, web services, and ADO.NET.

Many of the original critics of Visual Basic now praise VB.NET for providing a "complete" language, while supporters of Visual Basic claim VB.NET has made the language too complicated and too hard to use for simple application development. Another criticism of VB.NET is the incompatibility. VB.NET provides a wizard to help upgrade code, but many features are not converted properly. The wizard produces a list of places in the code where the upgrade is incomplete, but large projects have many thousands of such places requiring lots of programmer time to complete the upgrade.

[Top]

Other criticisms of Visual Basic

VB is criticized for:

[Top]

Evolution of Visual Basic

VB 1.0 was introduced in 1991. The approach for connecting the programming language to the graphical user interface is derived from a system called Tripod, originally developed by Alan Cooper, which was further developed by Cooper and his associates under contract to Microsoft.

During the Internet boom programmers were in great demand and many new programmers entered the field. These new programmers helped make VBScript one of the most common languages for web-based scripting on the Microsoft platform.

Recently, the use of VBScript has largely been superseded; in the browser it has almost completely been displaced by JavaScript and on the server by PHP, Java and .NET.

[Top]

Timeline

[Top]

Visual Basic and HyperCard

Putting Visual Basic into historical context invites comparison with HyperCard, a programming tool developed by Bill Atkinson, Dan Winkler, and their associates at Apple Computer and released in 1987. Both HyperCard and VB initially present the user with a "drawing" environment in which UI objects can be dragged, sized, captioned, and have a set of properties edited. Both connect a set of events, associated with the visual objects, to fragments of code. In both cases, the code is written in a programming language that is intended to cater to the novice and be easy to use. This is not to suggest that VB is a clone or copy of HyperCard. The relationship is more like that of C or Pascal to ALGOL; one can detect a family resemblance.

Unlike VB, HyperCard's programming language, HyperTalk, like COBOL before it (and AppleScript after it), consists of syntactically valid English sentences, such as "Get the number of card buttons." (Whether this actually makes it any easier to read, write, understand, or maintain than BASIC is arguable.)

The biggest difference, and the reason why VB was a breakthrough in a sense that HyperCard never was, is that VB produced applications that were virtually indistinguishable in look, feel, and general characteristics from Windows applications produced with traditional development tools. That is, it produced "real" Windows applications. HyperCard produced HyperCard stacks, not true Macintosh applications. HyperCard briefly spawned a limited cottage industry of commercial "stackware," rather like the former market in spreadsheet templates, but saw little commercial application (with notable exceptions: the fully commercial adventure game Myst was based on an elaborated version of HyperCard). HyperCard "stacks" were always recognizable as such.

HyperCard made a big impression when it was released in 1987, but for various reasons Apple did not follow it up vigorously or develop it much beyond what it was in 1987. By the year 2000 Apple had effectively abandoned it; it was officially discontinued in April, 2004.

[Top]

Similar languages

Some products are available for other systems that can interpret a subset of the Visual Basic language or similarly target rapid application development. These products are not source-code compatible with Visual Basic, but the similarity of their design environments allows Visual Basic expertise to be quickly leveraged into these environments.

[Top]

See also

[Top]




  View Live Article   This article is from Wikipedia. All text is available under the terms of the GNU Free Documentation License