A Quick Tour of Visual Basic 5.0
Microsoft's VB 5.0 development tool offers a new development environment, an updated language engine that provides native code compilation, and a substantial number of features.
August 31, 1997
Microsoft's Visual Basic (VB) 5.0 development tool offers a newintegrated development environment (IDE), an updated language engine thatprovides native code compilation, and a substantial number of features. The newIDE will make all VB developers more productive, and faster execution of nativecode will especially benefit algorithmic-intensive applications and components.Microsoft gives special emphasis to Internet and intranetdevelopment--particularly the ability to create ActiveX controls--to let VBdevelopers quickly build and deploy Web-based applications. Developers who useVB for corporate data access are probably the largest and most visible segmentof VB users. These developers can use the latest versions of VB's data accessengines to take advantage of new features and substantially increasedperformance.
Native Code Compilation
The feature developers requested most in VB 5.0 is the ability to compilesource code to natively execuTable code. VB 5.0 uses the same two-passcompilation process as Visual C++. The first pass parses the code and generatesa preprocessed interim format; the second pass optimizes and generates nativecode. VB 5.0 supports several of the same compiler options as VC++. The mostnoTable option is the ability to optimize for fast vs. small code.
Although developers were begging for native code, what they really wantedwas the execution speed that comes with natively compiled languages such as C.Native code offers substantial performance improvements in numeric-intensiveoperations, but it isn't a cure-all for every performance bottleneck. Nativecode makes sense in a VB application when developers must resort to C forwriting a performance-critical part of the application. With VB 5.0, instead oflearning a new language (or finding someone else to write the code), developerscan now get accepTable performance from a language they already know.
An assumption many people make about native code compilation is that iteliminates the need for a corresponding runtime. On the contrary, any p-code ornative code component or execuTable still requires the VB 5.0 runtime. Thisruntime requirement is not necessarily a bad thing. The alternative todynamically loading a common library (which is shared across many applications)is for each application to statically link to it, thus loading the library intomemory in each process. In practice, of course, the linker works with a standardlibrary format to pull into the execuTable-only functions that the main programcalls. Unfortunately, Microsoft never designed VB to be a library of discretecallable 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. Everyedition of VB has supported event-generating components (e.g., a CommandButton'sClick event). VB 4.0 let developers create object servers that exposedproperties and methods, but signaling between object servers was eitherinefficient (using timer-based code to periodically poll an object and check itsstatus) or complicated (passing an internal object to the server, whichsubsequently 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 exposedproperties, methods, and events) define the object. Using the component objectmodel (COM) architecture that underlies Object Linking and Embedding (OLE) andActiveX, one advanced component can include the interfaces that another originalcomponent provides. An application that uses the original component could havethe advanced component transparently replace the original component. A powerfulfeature of VB 5.0 is its ability to build ActiveX components that expose theproperties and methods (but not, in this release, the events) of one or moreobject servers. This feature, which enables multiple implementations of aparticular object specification, lets VB 5.0 developers create polymorphicobjects, according to well-established OOP methodologies.
Fortunately, not all the new features in VB 5.0 relate to creating ActiveXservers. For instance, developers can use the AddressOf operator to pass theaddress of a VB procedure to an external DLL function. This operator lets VBdevelopers use the Windows API functions that require a fixed callback address.AddressOf lets you trap any Windows messages sent to a form or control. Previousversions of VB required developers to use a third-party product to trap thesemessages. In addition, when you use AddressOf with the Win32 CreateThread API,you can create multithreaded applications in VB.
Internet
Most developers knew about VB 5.0's ability to create ActiveX controls longbefore Microsoft posted the Control Creation Edition beta on its Web site. Youcan use ActiveX controls in non-Web applications (they will be a key technologyin future Microsoft operating systems), but features such as code signing andprogressive downloading of data make ActiveX controls particularly well suitedto Web applications. However, the VB 5.0 runtime requirement poses one problemfor Web applications. To run a VB 5.0 ActiveX control, the VB 5.0 runtime mustbe present on the target system. This presence means that the first time youdownload a VB 5.0 ActiveX control, you must also undergo the 1.3MB download ofthe runtime before you can use the control. The control creation process can bea little confusing at first, particularly for developers who are not familiarwith writing components.
However, creating ActiveX documents couldn't be easier. VB 5.0 includes awizard for converting traditional forms-based VB projects into ActiveXdocuments. Unfortunately, VB 5.0-created ActiveX documents don't work the sameas the more familiar server applications such as Word and Excel. Instead ofcreating embeddable objects, VB 5.0 uses ActiveX documents to run a VBapplication inside a container application such as Internet Explorer (IE) or theMicrosoft Office Binder. Although Microsoft rewrote VB 5.0's Setup Wizard tohandle packaging of ActiveX components for Internet and intranet use, theprocess 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 thisreason, VB 5.0 includes two new controls to enable developers to extend theirapplications to include Internet technologies. The Internet Transfer Controlsimplifies the use of the two most common Internet protocols: HTTP forretrieving HTML pages and FTP for working with files. The Winsock controlprovides a convenient encapsulation of the underlying Windows Sockets library,which you can use for any socket-based activity, such as sending mail (SimpleMail Transfer Protocol--SMTP) and retrieving news (Network News TransferProtocol--NNTP).
Data Access
The data access changes in VB 5.0 are evolutionary rather thanrevolutionary. The trend in data access with VB is toward large-scale enterprisedevelopment, with a particular focus on ODBC. For this reason, the mostsignificant feature in the updated version of the Data Access Objects (DAO) thatships with VB 5.0 is ODBCDirect, which provides access to ODBC data sourcesthrough DAO without loading the Jet engine. ODBCDirect lets developers use oneobject library for both enterprise and local and workgroup data.
The Enterprise Edition's RDO 2.0 is an update to the thin object layer ontop of the ODBC API that first shipped with VB 4.0. RDO 2.0 offers many newfeatures, such as events and enhanced control over cursors, and it executessubstantially faster in many cases than RDO 1.0. Another data access mechanismto consider is ActiveX Data Objects (ADO), which ships with Internet InformationServer (IIS) 3.0 and works with OLE DB providers. So far, Microsoft has releasedOLE DB providers for SQL Server and generic ODBC, but other OLE DB providerswill 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 includethe following components:
*Data View: A graphical tool for creating, viewing, and editing databaseobjects.
*Database Designer: A tool for creating and modifying Microsoft SQL Serverdatabase objects including Tables, relationships, indexes, and constraints. Thistool also lets you generate and edit Transact-SQL (T-SQL) change scripts.
*Query Designer: A graphical tool for constructing and executing ODBCqueries. This tool also generates SQL and lets you edit, browse, and view livedata.
*Source Code Editor: A tool for creating, editing, and executing storedprocedures and triggers in SQL Server and Oracle databases.
Enterprise Development
For several years now, VB has been one of the most commonly used tools forcorporate data access. Thanks to RDO, VB successfully competes with data-centrictools, such as PowerBuilder, for traditional client/server development. Scalingtraditional client/server applications up to the enterprise level--wheredevelopers must distribute an application across a number of machines--has notbeen an easy task. To operate at this level, developers need to break outbusiness processing and data access code from both the client and the server andrun them in a separate, intermediate layer. This layer must scale acrossmachines to meet substantial throughput requirements. Microsoft's tool formanaging this intermediate layer is MTS, which centralizes handlingconfiguration, security, object queuing, connection management, thread pooling,and object synchronization. Bundling SQL Server and MTS with the EnterpriseEdition gives VB developers all the components necessary to do trueenterprise-level development.
Of course, managing a large-scale development process is not trivial.Microsoft has recognized this and developed Microsoft Repository for managingthe many components that comprise a complex software system. The first versionof Repository ships as an add-in to VB 5.0, and although it's not yet aspolished and complete as Visual SourceSafe, this enterprise tool shows thedirection Microsoft is heading.
Another important feature of the Enterprise Edition is Microsoft VisualModeler, a subset of Rational Software's Rose/Visual Basic tool. Visual Modelerlets developers create class diagrams for a system, generate the correspondingdefinition code, and regenerate class diagrams when the underlying code changesduring development. Visual Modeler wasn't ready when Microsoft released VB 5.0to manufacturing, so registered owners must download it fromhttp://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 keyareas. 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, thatare not yet available with any other high-level development tool. VB 5.0's onlyflaw is its complexity: A new developer can easily be overwhelmed by theavailable options. Fortunately, Microsoft offers versions for differentdevelopment environments and levels of expertise. Developers using VB 5.0 canspecialize in those areas--front-end desktop development, business ruleprocessing, and data access-- that best use their skills.
About the Author
You May Also Like