Demonstrating the Power of VisualAge: The VisualAge Bank

By Alex Gregor and Charlie Head

The VisualAge Bank was developed to show all the steps necessary to develop a complete application. It exhibits techniques from basic GUI development to advanced techniques such as multitasking, printing, multimedia and Dynamic Data Exchange (DDE). The VisualAge Bank covers important development topics like error recovery, debugging, porting and National Language Support (NLS). While VisualAge's visual building and parts provide the core functionality needed to do a complete application, it is necessary at times to extend these parts or develop new parts. The package demonstrates how to do this, and in addition, many of the new or extended parts can be used in other applications.

The VisualAge Bank currently is offered in two flavors. The VisualAge Bank for VisualAge C++ runs on OS/2 and will be ported to the Windows 95 and Windows NT platforms in the near future. The VisualAge Bank for Smalltalk runs on OS/2, Windows 95, and Windows NT. This version demonstrates the ease of porting among the VisualAge supported platforms. Future versions of the VisualAge Bank will support Java (TM), BART, and OO Cobol.

VisualAge Bank Overview
Each version of the VisualAge Bank consists of a set of samples, the sample application and a book. The samples are designed and structured using the incremental building-block approach. The developer, depending on experience with VisualAge, may start working sequentially through the samples or go directly to a particular advanced subject. At the beginning of each unit is a working sample ready to add the code necessary to show the features demonstrated in that unit.

The VisualAge Bank assumes the developer knows the base language (Smalltalk or C++) and is familiar with OO concepts. However, the samples do not require knowledge of how to develop an Object Oriented application or the VisualAge environment.

The VisualAge Bank also may be run as a demonstration application. The application offers video, sound, database access, the ability to exchange data with Lotus 123, drag and drop, and lots more.

The VisualAge Bank implements and demonstrates the following:
 * Menus, toolbars, various controls, cut/paste and drag/drop
 * Canvases, containers, notebooks, profiles and factories
 * Exception handling, and debugging
 * General and flyover help, and status bars
 * Building and modifying parts
 * Workplace Shell controls and primitives (Smalltalk only)
 * Multimedia
 * Dynamic Data Exchange (DDE)
 * Printing
 * National Language Support and Locale
 * DB2/2 Access and System Object Model (SOM)
 * Multitasking

Where to Find The VisualAge Bank
Both versions of the VisualAge Bank are delivered on disc 2 of the Developer Connection for OS/2 CD-ROM. The source code and libraries can be loaded into the appropriate development environment or directly executed for the testing purposes. This organization is valid for both samples and the sample application itself.

The VisualAge C++ version can be found in \VSBKSAMP and \VSBKBOOK subdirectories. The VisualAge Bank sample application is delivered with the installation procedure using the VSBKSAMP command file in the \VSBKSAMP subdirectory. The incremental sample structure with appropriate documentation in INF format can be found in the \VSBKBOOK subdirectory tree.

The version of the VisualAge Bank for Smalltalk can be found under the \VASTBANK directory structure which is described in the README.DOC. Installation of the VisualAge Bank sample application itself is handled by installers on all platforms. The installers are located in \VASTBANK\VSBKSAMP\OS2, WINNT or WIN95 subdirectories. The VisualAge Bank incremental samples directory structure is described in the README.DOC file under the \VASTBANK root directory.

A Walk Through the VisualAge Bank Sample Application
Open the VisualAge Bank folder and click twice on The VisualAge Bank program icon. The main application window appears.



The application implements multimedia features such as a welcome video and sounds on certain system events. As the application also must execute on a machine with no multimedia features installed, none of the multimedia options are selected by default.

National Language Support
VisualAge Bank supports five languages: English is the default language. The other languages may be selected during runtime in the VisualAge Smalltalk version. In the C++ edition the language must be selected and the application restarted.
 * English
 * French
 * German
 * Spanish
 * Chinese (Only the VisualAge Smalltalk version)

System Architecture
The VisualAge Bank system is designed in a classic three layer pattern: Each layer is described in more detail below along with its inter-dependencies. This model is implemented in the Smalltalk version. The BankSystem class is also described later in this article.
 * Visual layer: all the views and dialogs that represent the interface objects
 * Model layer: those objects which deal with business functionality
 * Persistence layer: objects concerned with loading from/saving to the database

Visual Layer
All the objects concerned with representing the model layer to the user come under this category. These objects are held in the BankVisualApp application and all inherit from the BankVisual class. Each visual class may be envisaged as representing a view on one model class or another. The system is designed so that the visual classes 'know' about their associated model class but there is no reciprocal knowledge. This makes the model classes less dependent on specific views and therefore increases possibilities for reuse of the business objects. On the whole, the less tightly bound together the layers are, in such a system, the better.

The model class associated with a view is held in its model attribute. Each view object needs to be notified of any change in its associated model so that the visual representation can be refreshed. This is effected by means of a mechanism whereby a view 'takes an interest' in certain events (eg #changed) being signalled by its associated model object. When these events are signalled, the view object will be notified and can then refresh itself.

Model Layer
The model layer consists of objects which deal with business functionality. That is to say that their responsibilities are purely business-oriented. These kinds of objects are often described as the 'business model' or 'business objects'. Such objects would be instances of classes like BankCustomerModel and BankAccountModel. All these classes are held in the BankModelApp application and all inherit from BankBusinessModel.

Each model instance holds as an attribute an instance of another class from the persistence layer whose task is to make that model persistent. Thus the model layer and the persistence layer are fairly closely interdependent. Each model class has a corresponding persistence class.



''Figure 3. The VisualAge Bank Object Model.''

Persistence Layer
In the VisualAge Bank for VisualAge Smalltalk, three groups of persistence objects are used as the persistence layer depending on which database is being written to. Responsibility for deciding which persistence objects to use belongs to the Bank System class (see below).

Note: These three Persistence layers are only implemented in the VisualAge Smalltalk version. The C++ version carries only the access to the DB2/2 database.

SQL Classes

These classes are all held in BankSQLApp and they are specifically responsible for dealing with the DB2/2 database when it is present. These include classes such as CustomerSQLPersistence.

Object Dumper Classes

These classes are held in BankDumperApp and are responsible for loading and saving their associated model objects when the ObjectDumper database is used. Such a class might be CustomerDumperPersistence.

SOM Wrapper Classes

These classes, such as Customer, are used when the SOM objects are used to provide database functionality. More information about SOM objects design can be found in the VASTBANK\CPPSOM\DOC subdirectory.

BankSystem class

This class is used to deal with many system-wide responsibilities including determining which persistence framework is in place. It also holds paths to files such as those used by the multimedia facilities as well as DDE. It is responsible for reading from and writing to the BANK.INI file (see below).

The BANK.INI File
The file BANK.INI contains parameters which affect the way the VisualAge Bank executes. For example, it holds language or multimedia choices made on the main window as well as information on where Lotus 123 is installed (for DDE use) and which database persistence layer is to be used. The system will use a default for any given parameter if it does not appear in BANK.INI.

If you have installed the VisualAge Bank system to use the DB2/2 database or DB2/2 database with SOM Objects, you can change it to use the Dumper files by making the following change: PERSISTENCE_TYPE=1.

The BANK.INI keywords are:

Summary
The VisualAge Bank was designed and developed by the IBM International Technical Support Organization (ITSO) in direct collaboration with the IBM Laboratories in Raleigh. Two customers were involved in the project, The Equitable Life Assurance Society and Bloomsbury Software, both from the United Kingdom.

Planned enhancements for the VisualAge Bank in the C/S environment include:
 * Retrieval and exchange of Lotus Notes memos and the application memos to/from Lotus Notes server
 * ATM credit card transactions using a CICS/2 back-end server
 * "Web Banking".