Visual Basic |
: This article is about the Visual Basic language shipping with Microsoft Visual Studio 6.0 and earlier. For the Visual Basic shipping with Microsoft Visual Studio .NET, see Visual Basic .NET. Visual Basic (VB) is an event driven programming language and associated integrated development environment created by Microsoft. In business programming, it has one of the largest user bases.
It is derived heavily from BASIC programming language. VB enables Rapid Application Development (RAD) of graphical user interface (GUI) applications, access to Databases using Data Access Objects, RDO, or ADO, and creation of ActiveX controls. A programmer can put together an application using the software component provided with Visual Basic itself.
= Derivative languages=
Microsoft has developed a number of Visual Basic versions for scripting applications:
When wishing to create a new programming tool, Microsoft had the option to either modify the popular Visual Basic 6.0, or create a totally new tool from the ground up. They chose the latter, and developed Visual Basic .NET, the successor to Visual Basic 6.0, which is part of Microsoft s Microsoft .NET platform. The VB.NET programming language is a true object-oriented language that compiles and runs on the .NET Framework. VB.NET is not backwards compatible with VB6, and it ships with a basic converter to upgrade legacy VB6 programs.
= Language features =
Visual Basic was designed to be usable by all programmers, whether novice or expert. The language is designed to make it easy to create simple GUI applications, but can be used to develop fairly complex applications as well. Programming in VB is a combination of visually arranging components on a form, specifying attributes and actions of those components, and possibly writing additional lines of code for more functionality. Since default attributes and actions are defined for the components, a simple program can be created without the programmer having to write many lines of code. Performance problems were experienced by earlier versions, but with faster computers this has become less of an issue.
Forms are created using drag and drop techniques. A tools palette is used to place controls (e.g., text boxes, buttons, etc.) on the form (window). 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 Visual Basic application can consist of one or more windows, or a single window that contains child windows, as provided by the operating system. 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 event 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, such as populating a related list.
Alternatively, a Visual Basic component can have no user interface, but be available to other programs, providing objects that implement functionality. This allows for server-side processing or an add-in model.
The language is garbage collection (computer science) using reference counting, has a large library of utility objects, and has basic Object-oriented programming. Since the more common components are included in the default project template, the programmer seldom needs to specify additional libraries. Unlike many other programming languages, Visual Basic is generally not case sensitive, although it will transform keywords into a standard case configuration and force the case of variable names to conform to the case of the entry within the symbol table entry. String comparisons are case sensitive by default, but can be made case insensitive if so desired.
= Controversy =
Visual Basic is a controversial language; many programmers have strong feelings regarding the quality of Visual Basic. It was designed to be a simple language. In the interest of convenience and rapid development, some features like compile time type-checking and variable declaration are turned off by default. This leads to some programmers praising Visual Basic for how simple it is to use, but also can lead to frustration when programmers encounter problems that the features would have detected (e.g., a typo generating an undefined variable error message).
Many critics of Visual Basic explain that the simple nature of Visual Basic is harmful in the long run. Many people have learned VB on their own without learning good programming practices. Even when VB is learned in a formal classroom, the student may not be introduced to many fundamental programming techniques and constructs, since much of the functionality is contained within the individual components and not visible to the programmer. Since it is possible to learn how to use VB without learning standard programming practices, this often leads to unintelligible code and workarounds. Second, having many of the checks and warnings that a compiler implements turned off by default may lead to difficulties in finding bugs. Experienced programmers working in VB tend to turn such checks on.
Many of the criticisms fired at of Visual BASIC are in fact criticisms of its ancestor, .)
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 Visual Basic coders and a very slight learning curve for programmers coming from other languages. Additionally, Visual Basic applications can easily be integrated with Databases, a common requirement. For example, by using controls that are bound to a database, it is possible to write a VB application that maintains information within the database without writing any lines of VB code.
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 Visual Basic s BASIC roots, and are included for backward-compatibility. The syntax of VB is different than most other languages, which can lead to confusion for new VB programmers. For example, the statement Dim a, b, c As Integer declares c as integer, but a and b are declared as Variant. Other characteristics include the entry of keyword, 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 accidentally omitting line-termination characters some languages require (usually semicolons). For example, the ability to enter variable and subroutine names in any case can be used to the programmer s advantage: by declaring all names in mixed case, but entering them in lower case elsewhere, allows the programmer to type faster and to detect typos when a token remains in lower case.
The language continues to attract much praise and criticism, and it continues to cater to a large base of users and developers. The language is well suited for certain kinds of GUI applications (e.g., front end to a database), but less suited for others (e.g., compute-bound programs). The language is simple and very well human readable and therefore well suited for maintenance and support its simplicity and ease of use explain its popularity as a tool for solving business problems most business stakeholders do not care about technical elegancy and effectiveness; they care about the cost and cost effectiveness of Visual Basic.
== Programming constructs not present in Visual Basic ==
While Visual Basic does not naturally support these features, programmers can construct work-arounds to give their programs similar functionality if they desire.
== Behaviors present in Visual Basic ==
VB has the following uncommon traits:
== Visual Basic and VB.NET ==
Visual Basic .NET, VB.NET, is a backwards-incompatible upgrade of Visual Basic to Microsoft s Microsoft .NET platform. Almost all 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, 64-bit integers and ADO.NET.
VB.NET is also a fully-compiled language (as opposed to previous versions which could both compile and interpret the language). Programs require compilation even if the program is only to be debugged. This resulted in a number of features being removed from Visual Basic, including the quick execution of programs, and the famous edit-and-continue feature (this feature will be restored in Visual Basic .NET 2005). Other significant features from past editions were also removed including control arrays.
Many of the original critics of Visual Basic now praise VB.NET for providing a complete language, while a few 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 and lack of similarity in syntax. 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. In particular the Variant data type, which was the default data type is no longer supported. Therefore, programs that did not declare all variables and/or those that depended on the Variant data type cannot be converted without significant effort. Programs written in VB.NET are not able to be feasibly converted back to VB6 code at all.
Some believe VB.NET support will diminish, with C Sharp programming language becoming the preferred language for .NET programming. This is despite the fact that both languages compile to the same .NET Common Intermediate Language, with the programming language choice merely a matter of syntax preference.
== Other criticisms of Visual Basic ==
= 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 (sometimes also known as Ruby ), originally developed by Alan Cooper, which was further developed by Cooper and his associates under contract to Microsoft.
== Timeline ==
== 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.)
Another difference that may have contributed to the rise of VB 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 true-form Windows applications. HyperCard produced HyperCard stacks, which do not resemble 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 1999.
=See Also=
*REALbasic *QuickBASIC
=External links=
*[http://www.computer-books.us/vb.php Computer-Books.us] - A collection of Visual Basic books available for free download. *[http://members.shaw.ca/mattleung/How%20to%20Create%20a%20Simple%20Game%20Using%20Microsoft%20Visual%20Basic.pdf How to Create a Simple Game in VB.NET] *[http://msdn.microsoft.com/vbasic/previous/vb6/ VB 6.0 at MSDN] *[http://www.vbcity.com/ VB City] *[http://www.free-ed.net/free-ed/InfoTech/vb01/ VB Lessons on Free-Ed.net] *[http://www.engineering.usu.edu/cee/faculty/gurro/Classes/Classes_Spring2002/VBGradClass/VBGradClass.htm Visual Basic 6.0 Tutorials by Gilberto E. Urroz] *[http://msdn.microsoft.com/vbasic/ Visual Basic at MSDN] (primarily supports the VB.Net version) *[http://visualbasic.about.com/ Visual Basic Section on About.com] *[http://www.developerfusion.co.uk/vb/ Visual Basic Section on Developer Fusion] *[http://www.vbtutor.net/ Visual Basic Tutorial for Beginners] *[http://www.fileinfo.net/extension/vb .VB File Extension Information] FileInfo.net|
|