Visual Age BASIC for OS/2

From OS2World.Com Wiki
Jump to navigation Jump to search

On Screen

There's just no getting away from BASIC, is there?

By Kent Rebman.

About 15 years ago now, BASIC was the first computer language that I learned, and it hasn't been too many years ago that I thought that I had left it behind for good. Given that my job duties are taking me increasingly away from programming and more toward web site maintenance, I thought I'd keep my hand in by taking a look at the newest member of IBM's VisualAge family of programming tools. There are quite a few VisualAge programming languages available now, as a visit to the IBM software homepage will make clear.

In addition to running on OS/2 (Version 3 and higher), VisualAge for Basic runs in Windows 3.1, as you have gathered from the name, Windows 95 and NT, and the Server portion runs on IBM's UNIX variant, AIX.

Where these versions vary is in their respective environments. The client environment allows you to build and run applications in OS/2 and both Windows versions. If you install the server support environment, you can also write stored VBX, OCX, and DB2 server procedures in these environments. The AIX environment includes the code to write server procedures only.

Installation

The IBM VisualAge for Basic for OS/2 and Windows package contains a CDROM, registration card, a piece of paper telling me in 16 languages I accept the licensing terms by using the program, a booklet (in 16 languages of course) titled International Program License Agreement, a proof of license card, a sheet of paper labeled "Customer Service and Support", yet another booklet (yup, 16 languages) titled License Agreement, and the only hardcopy manual, Getting Started.

Like pretty much all of IBM's desktop software products, VisualAge for Basic for OS/2 and Windows uses a common installation procedure that many, if not most, OS/2 users are probably familiar with by now: You put the CDROM in and run install from the appropriate directory. You should follow the procedure in the book, though: If you use the WarpCenter drives object to locate the appropriate executable, the installation will run to completion, but the program won't work after you reboot.

For those of you developing your own OS/2 applications, you might want to take a look at the Software Installer for OS/2 utility on the IBM Developer Connection CDROM set; visit the Developer's Connection web site for more information about acquiring the "Devcon" package.

One nice thing about these installation routines is that they have made installations a great deal simpler than they once were. However, I have a bone to pick with OS/2 programmers and it has to do with the program environment. VisualAge for Basic is no exception in regard to the fact that it wants to alter my config.sys. I don't have any real objection to this except that I don't think it's necessary: That's what the OS/2 INI files are for. Adding another directory, more or less, to the PATH, LIBPATH, and DPATH statements isn't a big deal-- until you run into that one program that goes haywire when the path length is too long, such as Lotus Notes 4.0 which refused to install if it exceeded 256 characters. (And the error message was so obscure, you'd never figure it out from that.)

It would seem to me that rather than extending the PATH statement in my config.sys to several hundred characters (I saw one that topped out at 514 the other day), programmers could make better use of the ability of the INI files to provide environmental data their programs need. If I can get to it with a simple REXX exec, there's no telling what someone who knows what they're doing can accomplish.

At the time of the installation, you chose which of the environments (client or server) you are going to install, and you are offered the opportunity to install several components related to each. The component list is the same for either version.

The "Base" and "On-line Books" should be self-explanatory; the SOMObjects Toolkit allows you to build "SOMSupport applications" with VAB, the ODBC driver provides database connectivity, and the Communications provides connectivity to the database you're using via APPC, EHLLAPI, NetBIOS, or TCP/IP.

The installation routine creates a VisualAge for Basic folder which contains three items: a VisualAge for Basic Samples folder, VisualAge for Basic Information folder, and a program object. All the bells and whistles occupied about 35 megabytes on my system.

You will want to take a look at both the readme displayed by the installation routine, as well as at least one of the text files that are placed into the default VABASIC installation directory. The installation information contains an interminable licensing section, and then some useful information, including a web site address for product support. There are plenty of goodies at the web site, including a pointer to product resellers.

The text files copied onto your disk during installation are:

  • install.txt
  • license.txt
  • notices.txt
  • version1.txt

Install.txt contains the same installation instructions as the 'Getting Started' manual, and license.txt and notices.txt are only of interest to lawyers. However, version1.txt contains some information you are going to want to know, and judging by what I see, you'll want to know sooner rather than later.

For instance, in this file you'll find the occasional gem like this:

E.1. Miscellaneous: Creating a SOM object on a form

When you create a SOM object on a form, VisualAge for Basic may crash.

Details: when you select a SOM class from the Component Catalog, and use the
Toolbox to create a SOM object on a form, VisualAge for Basic may crash.

SOM objects that may cause this error include: AttributeDef, ConstantDef,
Contained, ExceptionDef, InterfaceDef, ModuleDef, OperationDef,
ParameterDef, SOMDClientProxy, SOMMSingleInstance, and TypeDef.

Actions that may cause this error include:
  -- Selecting the object on the form and clicking on the Delete key.
  -- Going to the File menu and selecting New Project
  -- Going to Project Window Run Menu and clicking on Run, then on End

Or perhaps you'll be intrigued by these:

E.3. Miscellaneous:  The Two-Dimensional Graphics Part

The Two-Dimensional Graphics Part (shipped with the OpenDoc
runtime), will crash VisualAge for Basic if the "link" pages
are selected from the OpenDoc Properties notebook. The link
pages are not active, so this is not a functional problem.

------------------------------------------------------------------------
E.4. Miscellaneous:  The OpenDoc Cookbook part

The OpenDoc Cookbook part is not recommended for use in
VisualAge for Basic at this time.

Sorry, I guess I must be a little old fashioned because a crashing program is a functional problem as far as I'm concerned.

These might be bad enough, but this one could be a definite show stopper.

F.3. Run-Time Problems:  Running executables while VisualAge for Basic
is running.

On OS/2, you cannot run a generated executable while VisualAge for Basic
is running.  The session running the generated executable will crash
with a system error 3175.  Closing VisualAge for Basic prior to running
a generated executable will work.  This restriction also applies to
running more than one generated executable at once on OS/2.

This is potentially a real hangup for a serious application developer. It could get really annoying to start and stop VAB everytime you wanted to check an older version of a program against a newer one.

It should also be noted that this file details some special requirements for running the second tutorial.

Running the Program

The first thing I checked was the 'Getting Started' book in the VisualAge for Basic Information folder. It is basically identical to the hardcopy version, and I elected to start with the 'Quick Tour.'

It's a good idea to review the terminology section, because if you are not familiar with at least some of the jargon it may throw you. On the other hand, if you've been using tools like VX-REXX from Watcom, or VisPro REXX from HockWare, as I have, it will seem quite familiar.

A couple of quick pointers on terminology.

Form
The graphical windows where your application runs.
Properties
The attributes of a form, some of which are set at design time, others at runtime.
Components
Components are things you place on forms, such as text boxes or command buttons; each has specific properties.
Events
Are generated by user action such as clicking a button.

An important conceptual point here is that these programs are event driven unlike the programs we are used to writing where the user enters the code at a single point and follows a predetermined path through the program. Event driven applications are more powerful because of their flexibility, but require more thought and planning in their initial development.

As you might expect, the examples in 'Getting Started' are pretty simple and straightforward. I guess we sometimes take for granted the steps in using a program development tool, so they've reminded us of them:

  1. Start VisualAge for Basic
  2. Create the user interface
  3. Set properties
  4. Program the behavior of objects
  5. Run the application
  6. Save the application

The first time you run the program, you'll get the online registration wizard. I don't know whose innovation this was, but I'm not crazy about it. I suppose it's good to encourage people to register their products, but there have to be less intrusive ways. Parenthetically I note that some of you who have migrated to Merlin maybe periodically annoyed by this same phenomenon. If you'll rename the subdirectory \OS2\ART to something else, well, your troubles will be over in this regard.

The program initially starts up in three separate windows, comprising the actual main window for the program you are developing ("Form1"), the Toolbox, and the project design window.

The project design window lists all the objects, such as program modules, in your project. The Toolbox contains all the objects you may drag into your application window. If you'll check around for preferences settings, you'll discover that the Toolbox can be reduced to pictures-only or text-only, so it will take up less space on your desktop-- a definite plus.

Following the example in the manual, I used the default "Form1" to create my test program. I am happy to say that for the first time I can remember, I didn't create "Hello World", but instead, something called Touchy Buttons which required me to create a text box and two buttons. As with most visual programming tools, creating the objects on the form was a simple matter of selecting what I wanted on the Toolbox, then clicking and dragging in the form window.

One of the things I liked about this tool is something that's relatively mundane. The presence of grid dots on the background of these tools has always bugged me, but this one does not by default show the dots except when you're dragging an object on the form, which is when you really need it. However, you can turn them on (as well as alter the default alignment, code window text size, and other variables) in the 'Options' menu of the project design window.

Once you have the text box and two buttons dragged onto the form, it's time to associate some code with them. The code development window for any object on the form can be brought up by simply double-clicking on the object as you can see here.

One of the nice things about the approach of VAB is that all of your coding is done in a single code window per form object. You'll notice a list box with the 'click' event displayed. If you pull it down, you'll see all the other things you can do with the object (in this case, a button called "command1").

VAB has a nice way of dealing with the properties of an object in your form, also. If you're familiar with VX-REXX, you'll recall that double clicking on an object on a window brings up a notebook that controls both appearance and behavior of the object, and from there, you may end up with a large number of code windows visible. VAB separates the properties from the coding. As I already mentioned, double clicking the object brings up it's code window. Using the 'Window' pulldown in the project window allows you to select the 'Property Editor', or you can simply hit F4.

What you get from there is a list of all the possible properties of an object you can change at design time (remember, they're also changeable at runtime). As you select items, the property value line in the list may become a pulldown with the available choices, a text entry field (the button text, for instance), or a palette, as in this example.

Another nice thing is what I call the 'question' button. You'll notice on some of these windows a mouse pointer next to a question mark. If you select it, your mouse pointer changes into this icon and whatever you click on next will bring up either the online help, or a small text box explaining what you clicked on.

The behavior of the program is pretty responsive, although it is fairly noticeable where breaks to different modules occur. For instance, when you drag your first object onto a form after you start the program, you can tell another module is loading, as well as when you first bring up the coding window.

The debugging tools are those you would expect: add, edit, and toggle breakpoints, set 'watch points' for strings, call and inspect the stack, as well as a pretty complete syntax checker.

Documentation

Well, that's a (very) quick look at using VAB. In addition to 'Touchy Buttons', there are also tutorials in Getting Started on:

  • Creating a GUI application
  • Creating SOM Objects
  • Accessing External Files
  • Accessing Databases
  • Subclassing Visual Objects

The online books shipped with the system are very thorough. In particular, the Basic Programming Guide includes sections on debugging and testing techniques which are often lacking altogether in other products or are extremely thin.

In addition to the sort discussion of language syntax you would expect to find, you'll also get extensive information on integrating VAB applications with other languages and techniques including SOM, OpenDoc, OCX, OLE, and external DLLs, as well as a discussion of performance tuning and writing cross-platform applications.

The appendixes include one that discusses migrating Visual Basic programs as well as a cross-reference between Common Object Request Broker Architecture (CORBA) objects and VAB data types for those of you deeply into object oriented programming.

One of the nicest things done with the documentation is the presence in the 'Getting Started' manual of a list of all the relevant documentation, not just what is shipped with the product. IBM has for years written lots of related manuals about their products but unfortunately, their availability wasn't always common knowledge. Of course, with a brand new product, this list is fairly short (it's on page ix of 'Getting Started'), but it also includes the IBM publication number for the online manuals if you'd like to order a hard copy, which is my personal preference.

Thumbs up or down?

Like almost any V1 product, there are a few warts. The application opens slowly, as do the code windows within your project, but let's face it, there are bigger problems with products than these. There is one annoying behavior I discovered, that I suppose is really a matter of taste; when doing a Save as ... of a project, I was queried as to whether I wanted to save individual forms, rather than just saving everything without my having to pass judgment on individual elements. But to each his own, I suppose...

IBM's VisualAge for Basic for OS/2 and Windows definitely has some things to recommend it. From a sort of an esoteric standpoint, the fact that IBM works with open standards, developing applications in this environment should make it easier for those applications to exist in a heterogeneous systems environment-- which is about 99% of them.

If you're into closed architectures, the fact that it will coexist with OCX, VBX, and OLE is a plus as well.

If you're really into open object orientation, integration with SOM, OpenDoc, and CORBA is a definite plus.

For its organization, flexibility, and extensibility, I give it a thumbs up.

Caveats ...

So no one is misled, I point out that I am an IBM employee and stockholder. Insert standard legal disclaimers here. Your mileage will vary. Understand also, I program for fun, not for profit, so if my programs crash and burn and are hard to maintain, it is not the end of the world. This is also only about a $100 product.

However, I also know that I have 4 compilers from 3 different publishers sitting on the shelf that I've never used the fourth or subsequent times because they were, frankly, no good. I think VAB will last a little longer.

One final rant: I spent forty-five minutes on the web looking for a price for this product. (What IBM claims it costs and what you'll actually pay for it are, of course, two entirely different things.) During that time I was on the web sites of five different vendors of software, for all of whom that is probably 90+% of their business. Only at two of them could I find a price for the product, at the IBM Direct web site, and 'natch, at Indelible Blue. What's really sorry is that at two of them, by following interminable drill down lists, I was able to find some members of the VisualAge family of products but at neither of them would using their alleged-search engines turn up any IBM product. At one of them, a search on "Microsoft" turned up ... two hits. At one of them, I was not able to access an online catalog at all and clicking their search button just reloaded the page I was on. 'Lest you think that this was a WebExplorer problem, things were not any better using Netscape.

A truly pathetic state of affairs; I don't mention their names so that when you stumble across them you'll also fire off a nasty gram.

Enjoy your experience with VisualAge for Basic!


Kent Rebman is a technical specialist on the IBM Midwestern Marketplace Open Systems Center staff and is crazy enough to have been using OS/2 since the beta of version 1.0.

The graphics in this report were created by using a registered copy of PMJpeg for screen captures. The VisualAge logo was stolen from the IBM Software homepage.