A Quick Tour of Visual Basic 5.0

Microsoft's Visual Basic (VB) 5.0 development tool offers a new integrated development environment (IDE), an updated language engine that provides native code compilation, and a substantial number of features. The new IDE will make all VB developers more productive, and faster execution of native code will especially benefit algorithmic-intensive applications and components. Microsoft gives special emphasis to Internet and intranet development--particularly the ability to create ActiveX controls--to let VB developers quickly build and deploy Web-based applications. Developers who use VB for corporate data access are probably the largest and most visible segment of VB users. These developers can use the latest versions of VB's data access engines to take advantage of new features and substantially increased performance.

Native Code Compilation
The feature developers requested most in VB 5.0 is the ability to compile source code to natively execuTable code. VB 5.0 uses the same two-pass compilation process as Visual C++. The first pass parses the code and generates a preprocessed interim format; the second pass optimizes and generates native code. VB 5.0 supports several of the same compiler options as VC++. The most noTable option is the ability to optimize for fast vs. small code.

Although developers were begging for native code, what they really wanted was the execution speed that comes with natively compiled languages such as C. Native code offers substantial performance improvements in numeric-intensive operations, but it isn't a cure-all for every performance bottleneck. Native code makes sense in a VB application when developers must resort to C for writing a performance-critical part of the application. With VB 5.0, instead of learning a new language (or finding someone else to write the code), developers can now get accepTable performance from a language they already know.

An assumption many people make about native code compilation is that it eliminates the need for a corresponding runtime. On the contrary, any p-code or native code component or execuTable still requires the VB 5.0 runtime. This runtime requirement is not necessarily a bad thing. The alternative to dynamically loading a common library (which is shared across many applications) is for each application to statically link to it, thus loading the library into memory in each process. In practice, of course, the linker works with a standard library format to pull into the execuTable-only functions that the main program calls. Unfortunately, Microsoft never designed VB to be a library of discrete callable routines.

Language Features
VB 5.0 adds several important features to the underlying language engine. The most useful feature is the ability to create, or source, events. Every edition of VB has supported event-generating components (e.g., a CommandButton's Click event). VB 4.0 let developers create object servers that exposed properties and methods, but signaling between object servers was either inefficient (using timer-based code to periodically poll an object and check its status) or complicated (passing an internal object to the server, which subsequently executed an exposed method to call back into the internal object). Using VB 5.0, developers can create and handle events.

To the outside world, an object's interfaces (which include its exposed properties, methods, and events) define the object. Using the component object model (COM) architecture that underlies Object Linking and Embedding (OLE) and ActiveX, one advanced component can include the interfaces that another original component provides. An application that uses the original component could have the advanced component transparently replace the original component. A powerful feature of VB 5.0 is its ability to build ActiveX components that expose the properties and methods (but not, in this release, the events) of one or more object servers. This feature, which enables multiple implementations of a particular object specification, lets VB 5.0 developers create polymorphic objects, according to well-established OOP methodologies.

Fortunately, not all the new features in VB 5.0 relate to creating ActiveX servers. For instance, developers can use the AddressOf operator to pass the address of a VB procedure to an external DLL function. This operator lets VB developers use the Windows API functions that require a fixed callback address. AddressOf lets you trap any Windows messages sent to a form or control. Previous versions of VB required developers to use a third-party product to trap these messages. In addition, when you use AddressOf with the Win32 CreateThread API, you can create multithreaded applications in VB.

Most developers knew about VB 5.0's ability to create ActiveX controls long before Microsoft posted the Control Creation Edition beta on its Web site. You can use ActiveX controls in non-Web applications (they will be a key technology in future Microsoft operating systems), but features such as code signing and progressive downloading of data make ActiveX controls particularly well suited to Web applications. However, the VB 5.0 runtime requirement poses one problem for Web applications. To run a VB 5.0 ActiveX control, the VB 5.0 runtime must be present on the target system. This presence means that the first time you download a VB 5.0 ActiveX control, you must also undergo the 1.3MB download of the runtime before you can use the control. The control creation process can be a little confusing at first, particularly for developers who are not familiar with writing components.

However, creating ActiveX documents couldn't be easier. VB 5.0 includes a wizard for converting traditional forms-based VB projects into ActiveX documents. Unfortunately, VB 5.0-created ActiveX documents don't work the same as the more familiar server applications such as Word and Excel. Instead of creating embeddable objects, VB 5.0 uses ActiveX documents to run a VB application inside a container application such as Internet Explorer (IE) or the Microsoft Office Binder. Although Microsoft rewrote VB 5.0's Setup Wizard to handle packaging of ActiveX components for Internet and intranet use, the process is still complicated and almost always involves a lot of testing.

Of course, not every application client uses a Web browser for the client: Many applications involve substantial client-side functionality. For this reason, VB 5.0 includes two new controls to enable developers to extend their applications to include Internet technologies. The Internet Transfer Control simplifies the use of the two most common Internet protocols: HTTP for retrieving HTML pages and FTP for working with files. The Winsock control provides a convenient encapsulation of the underlying Windows Sockets library, which you can use for any socket-based activity, such as sending mail (Simple Mail Transfer Protocol--SMTP) and retrieving news (Network News Transfer Protocol--NNTP).

Data Access
The data access changes in VB 5.0 are evolutionary rather than revolutionary. The trend in data access with VB is toward large-scale enterprise development, with a particular focus on ODBC. For this reason, the most significant feature in the updated version of the Data Access Objects (DAO) that ships with VB 5.0 is ODBCDirect, which provides access to ODBC data sources through DAO without loading the Jet engine. ODBCDirect lets developers use one object library for both enterprise and local and workgroup data.

The Enterprise Edition's RDO 2.0 is an update to the thin object layer on top of the ODBC API that first shipped with VB 4.0. RDO 2.0 offers many new features, such as events and enhanced control over cursors, and it executes substantially faster in many cases than RDO 1.0. Another data access mechanism to consider is ActiveX Data Objects (ADO), which ships with Internet Information Server (IIS) 3.0 and works with OLE DB providers. So far, Microsoft has released OLE DB providers for SQL Server and generic ODBC, but other OLE DB providers will be coming soon.

The Enterprise Edition also includes Microsoft's new Visual Database Tools. These tools run as an add-in to the VB 5.0 IDE. Visual Database Tools include the following components:

* Data View: A graphical tool for creating, viewing, and editing database objects.

* Database Designer: A tool for creating and modifying Microsoft SQL Server database objects including Tables, relationships, indexes, and constraints. This tool also lets you generate and edit Transact-SQL (T-SQL) change scripts.

* Query Designer: A graphical tool for constructing and executing ODBC queries. This tool also generates SQL and lets you edit, browse, and view live data.

* Source Code Editor: A tool for creating, editing, and executing stored procedures and triggers in SQL Server and Oracle databases.

Enterprise Development
For several years now, VB has been one of the most commonly used tools for corporate data access. Thanks to RDO, VB successfully competes with data-centric tools, such as PowerBuilder, for traditional client/server development. Scaling traditional client/server applications up to the enterprise level--where developers must distribute an application across a number of machines--has not been an easy task. To operate at this level, developers need to break out business processing and data access code from both the client and the server and run them in a separate, intermediate layer. This layer must scale across machines to meet substantial throughput requirements. Microsoft's tool for managing this intermediate layer is MTS, which centralizes handling configuration, security, object queuing, connection management, thread pooling, and object synchronization. Bundling SQL Server and MTS with the Enterprise Edition gives VB developers all the components necessary to do true enterprise-level development.

Of course, managing a large-scale development process is not trivial. Microsoft has recognized this and developed Microsoft Repository for managing the many components that comprise a complex software system. The first version of Repository ships as an add-in to VB 5.0, and although it's not yet as polished and complete as Visual SourceSafe, this enterprise tool shows the direction Microsoft is heading.

Another important feature of the Enterprise Edition is Microsoft Visual Modeler, a subset of Rational Software's Rose/Visual Basic tool. Visual Modeler lets developers create class diagrams for a system, generate the corresponding definition code, and regenerate class diagrams when the underlying code changes during development. Visual Modeler wasn't ready when Microsoft released VB 5.0 to manufacturing, so registered owners must download it from http://www.microsoft.com/vstudio/owner/default.asp.

Be More Productive
VB 5.0 is a major advance over the previous version in a number of key areas. First, it's significantly faster, even if you don't use native code. Second, the new IDE can make developers significantly more productive. Finally, VB 5.0 has capabilities, such as the ability to create ActiveX controls, that are not yet available with any other high-level development tool. VB 5.0's only flaw is its complexity: A new developer can easily be overwhelmed by the available options. Fortunately, Microsoft offers versions for different development environments and levels of expertise. Developers using VB 5.0 can specialize in those areas--front-end desktop development, business rule processing, and data access-- that best use their skills.

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.