Developing Web Applications with MS Visual InterDev and MS Visual Basic

a collaborative effort by:

Valor Whisler and Jim Soiland
August 30, 1997

Valor Whisler is an applications architect specializing in user interface and system design and development. Valor has designed and developed numerous successful commercial products including VB AppFramework and the Repository Browser. Jim Soiland is a software engineer specializing in Visual Basic and Microsoft BackOffice technologies. Valor can be reached at valorw@ix.netcom.com.

Abstract

This document describes how Microsoft Visual Basic combined with Microsoft Visual InterDev and Microsoft BackOffice technologies can be used to build web applications. In doing so it shows how existing skills can be leveraged, how existing tools can be used, and how existing methodologies can be applied to existing applications.

*
On This Page
IntroductionIntroduction
The Web: A Distributed ArchitectureThe Web: A Distributed Architecture
A Visual Basic ExampleA Visual Basic Example
Design MethodologyDesign Methodology
Installing the Sample ApplicationsInstalling the Sample Applications
ConclusionConclusion

Introduction

The compulsion to move to the web is so overpowering that it is safe to say that every software engineer will be faced with the prospect of web development. I'm sure that every developer has their opinion of the value of the web — yes it's over-hyped — but one thing is crystal clear: it is a powerful communications channel that we can count as we develop our next generation of systems.

Top of pageTop of page

The Web: A Distributed Architecture

The web forms a communications medium that allows for distributed objects to be easily brought together. Almost every page you view utilizes this fundamental architecture to combine text, graphics, and active objects into a single presentation. This capability requires a change in the way that an application is designed and developed.

The logical architecture of a web application is very similar to that of a client-server, or n-tiered architecture. There are, however, some key physical differences. For example, an HTML page provides a user interface and an Internet Information Server facilitates the back-end processing. The following diagrams help to illustrate the differences and similarities between web and client-server architectures. These diagrams illustrate one simple usage scenario — there are many other possible types of architectures.

sn0at

See full-sized image.

Client-Server Architecture

In a client-server architecture a Visual Basic application sends requests to a Microsoft SQL Server using a private network. This is usually some type of LAN or WAN. The server processes these requests and returns data. It is completely up to the VB application to interpret and display this data.

sn1at

See full-sized image.

Web Architecture

In a web architecture an HTML form which is created by an Internet Information Server (IIS) is displayed in an Internet Explorer. Information that is entered is returned to the IIS using HTML methods such as Post. The IIS can then use an Active Server Page (ASP) to process the input data and return a result page.

Notice that within the web architecture diagram there is no logic being invoked on the client-side. The Internet Explorer is merely displaying HTML pages and transporting data to-and-from the server. There are, of course, several ways to utilize logic on the client-side such as VB Script and ActiveX objects but the diagram reflects one of the most typical usage scenarios found today.

Here are some key characteristics of web architectures:

The medium is open, public (Intranets can be made private), and distributed.

All operations are performed within an external container: the Browser.

Currently the majority of logic is performed on the back-end.

HTML 3.2 provides for very little intra-page processing, although HTML 4.0 promises this capability. For example, let's say you wanted to disable a button based on a particular option button selection. In Visual Basic this is simple, whereas an HTML page does not provide this type of interaction.

Top of pageTop of page

A Visual Basic Example

This section describes a simple Visual Basic application that was built as a stand-alone and how it can be moved to the web. There is source provided for both the Visual Basic and the web applications. The following section outlines the methodology used to create both applications.

sn2at

A Visual Basic Application

The figure above shows a Visual Basic application that employs a component architecture which is used to separate the validation routines from the user interface. This is done to take advantage of the reusability potential of the validation objects and to physical segment the development workload in a team development environment. In addition, this architecture supports distribution of the validation objects onto physically separate machines, thus providing a more scaleable architecture.

The two validation objects are constructed as ActiveX DLLs, but they could also be made into ActiveX EXEs. They are: (1) a Name & Address Validation server and (2) a Credit Card Validation server. The name & address validation server uses sets of business rules to determine the validity of the name and address. If the data is invalid an error message is generated. The credit card validation server is called to validate a credit card. One could envision that this server could, in turn, call up an external credit card validation service bureau to perform this task.

sn3at

See full-sized image.

A Visual Basic Web Application

The above figure shows the same Visual Basic application that has been re-architected for web deployment. The name, address, and credit card input has been re-done as an HTML form. Information entered into this form is sent to an active server page (ASP). The ASP invokes the two Visual Basic validation DLLs. If either servers does not validate the data, it provides an error message that can be propagated back to a user via the ASP. Note that the two validation DLLs shown in the web architecture are physically the exact same DLLs used in the stand-alone Visual Basic application. Thus, the original component architecture that was employed in the stand-alone application can be reused in the web application.

Note: Business objects can perform any type of task that is possible using the Visual Basic programming environment — in this example they merely perform validation tasks.

sn4at

See full-sized image.

The Visual Basic Form

sn5at

See full-sized image.

The Web Form

Top of pageTop of page

Design Methodology

Due to the open nature of the web's architecture, there are many possible ways to design and develop an application. This section introduces one possible methodology; one that effectively leverages existing Visual Basic skills, tools, training, as well as existing the code base. Here is a high-level view of the methodology that was used:

1.

Decompose the problem into logical services — for the above example we have the following services: (1) user interface, (2) web, (3) business rules, and (4) data. Define the functions that are to be provided by each service.

2.

Identify the workflow and define the interactions between the services.

3.

Define the interfaces between the services.

4.

Construct the business and data services.

5.

Construct the user interface.

6.

Build the web services in a way that provides a glue between the interface and business services.

sn6at

See full-sized image.

Application Services

Top of pageTop of page

Installing the Sample Applications

A set of sample projects are provided to further illustrate the applications and concepts that were described in this paper. The projects are simple examples of how to migrate a Visual Basic application to the web while leveraging existing skills. The examples consist of four projects:

1.

Visual Basic 5.0 Application

2.

Internet Application

3.

Business Rules Visual Basic ActiveX DLL

4.

Credit Card ActiveX DLL

Note: If you wish to run the Internet application you must have Internet Information Server or Personal Web Server properly installed and configured on your system (including Active Server Pages).

To use the projects:

1.

Register the Business Rules DLL (BusinessRules.dll) using RegSvr32.exe.

2.

Register the Credit Card DLL (CreditCard.dll) using RegSvr32.exe.

3.

Use the Web Services Manager to add a virtual directory (http) that refers to the directory that contains the process_billing.asp and billing_information.htm files. Be sure that you enable the read and execute options for this virtual directory.

4.

Start Internet Explorer.

5.

Run the Internet Application by navigating to the billing_information.htm file (i.e. http://<your servers name>/<virtual directory>/billing_information.htm).

6.

Run the Visual Basic application by executing Billing.exe or by opening the Billing.vbp project and running it.

Note: The source code for the Visual Basic ActiveX DLL's is also provided. The source code can be viewed by opening the BusinessRules.vbp or CreditCard.vbp projects using Visual Basic 5.0.

Top of pageTop of page

Conclusion

The web is a powerful medium; an open communications channel with a standardized set of protocols. In many situations, monolithic or even locally componentized applications will give way to highly distributed, asynchronous, web-based applications. Yes, the specific architectures and methodologies will change dramatically but the underlying way that a user interacts with an application will not. It is important to leverage existing skill-sets and tool-sets during this migration and to pick the best-of-breed tools to move ahead with. Microsoft Visual Basic not only provides a mature development platform for web development but also allows your language skills to be used in the form of VB Script.

© 1997 Microsoft Corporation. All rights reserved.

The information contained in this document represents the current view of Microsoft Corporation on the issues discussed as of the date of publication. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information presented after the date of publication.

This document is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY.

Microsoft, MS-DOS, Visual Basic, Visual InterDev, and Windows NT are registered trademarks of Microsoft Corporation.

Other product and company names mentioned herein may be the trademarks of their respective owners.


Top of pageTop of page