Borland's Windows version of an industry-standard database adds object-oriented functionality and retains backward compatibility. But is it enough?
Jim Carls
Long ago (that is, in the mid-1980s), dBase was a key weapon in the rebellion against mainframe DBMSes (database management systems). As it earned the interest and then the devotion of oppressed middle managers looking to capitalize on the PC, dBase built a huge following and grew more powerful through several versions.
Then, alas, came dBase IV, the Jabba the Hut of database managers, a memory-gobbling slug of a program with an inclination to choke on program code too modular for its taste. A hemorrhage of users followed. Then parent company Ashton-Tate was acquired by rival Borland International. Observers wondered if Borland would simply kill dBase, but
even after the exodus, the dBase users and programmers remaining were legion. Borland released dBase IV 2.0, which finally ended the memory problems, but the program was still based on the waning DOS interface.
Now that there is a Windows version of dBase, the question is whether the current incarnation of dBase can compete against the likes of Microsoft Access, FoxPro for Windows, and even Borland's own Paradox.
Vital Signs
The revamped dBase is a likely contender. For one thing, programs written in dBase III+ and IV will generally run as-is in the command window (which replaces the dot prompt of earlier versions). There are a few compatibility items you need to check, but these are clearly explained in the manuals, a READ.ME file, on-line help, and a module called the Component Builder. Problems are most likely to result from unlucky coding choices you made while developing under a previous version. Specifically, you might have used function names and variable names tha
t have since been added to the list of dBase keywords. If so, you'll have to change them to avoid conflicts.
To take you beyond mere backwards compatibility, the Component Builder can convert some components (specifically .FMT, .FRM, and .LBL files and the menu definitions within .PRG files) into dBase for Windows code that takes advantage of the object-oriented Windows user interface.
The new version is more than simply a Windows-interfaced version of dBase IV. The dBase language has acquired the features available in general-purpose languages (e.g., C++ and other Xbase languages, such as Clipper) that help you build flexible, rock-solid applications. These include a preprocessor, local and static variables, code blocks, and the ability to use procedures or user-defined functions interchangeably wherever the language can accept an expression.
dBase for Windows is an object-oriented development system, giving you the ability to declare your own object classes. True, you can still write p
rocedural dBase code until you retire, but you can also take advantage of the language extensions to make the transition to OOP (object-oriented programming).
Although the manuals contain clear introductions to the subject, it is the Two-Way Tools feature that can really help smooth the OOP transition. With Two-Way Tools, the definitions of objects you create visually are stored as dBase code in separate files. You can create an object and then open, view, and even edit the resulting code file. Not only do you create your own examples, but you can easily do search-and-replace code changes that would be difficult using only a mouse-driven interface.
Creating a Sample Application
Installing dBase is straightforward, unless you don't have 21 MB of space on your hard disk for a full installation. My original disk set included a bad disk, but Borland's technical support soon sent a replacement. The installation program checks for adequate space and lets you do a minimal install
if you're too cramped for room.
To get a feel for the new version, I created a basic billing system similar to what a franchised service organization, such as a pest-control or building-maintenance company, might use. The system required six tables organized around a central table to which services would be posted, billed, and paid. In order to provide the data necessary to create the service records, I set up reference tables for customers, franchisees, service types, billing-table headers, and billing-table contents.
The first step in creating such a system in dBase is to set up a "catalog," a concept retained from earlier versions and equivalent to a "project" in FoxPro and the more traditional "database" in Access.
Although the command window gives you immediate access to all old (and new) commands, the easiest way to create anything is through the Navigator, which is a control panel similar to those in other Windows DBMSes. All files of a certain type in the system are grouped under
an icon. Each list of files includes an untitled file, with which you can create new ones of that file type. Although a catalog is a file type, opening a catalog is like opening a subnavigator, which limits the file list to those in the catalog. For a quick introduction to setting up a system (or if you are brand new to databases), a set of interactive tutorials easily walks you through the process as you create your own files.
After establishing a catalog for my sample system, I initialized a new table by clicking on the tables icon, then double-clicking on the untitled table. Anyone familiar with dBase will be familiar with setting up the table fields, because the arrangement of name, type, width, decimals, and index fields is the same as it is in dBase IV. What is new is the ability to push a button and create a Paradox table just as easily.
Unlike some DBMSes, dBase does not store such things as valid clauses, formatting, or field labels in the table definition. Longtime dBase users will be
accustomed to this approach, but if you're setting up a system that will be used by people unfamiliar with dBase, avoid giving them access to direct table editing; stick instead to the easier methods of using forms or a carefully crafted browse or query.
Making Queries
Unless you are working from an extremely simple database design, you will create queries as the basis of your forms and reports. You use the
Query Designer
for this. It lets you add tables graphically to the query, order the records, pick fields, and set relationships among the tables. I clicked on the untitled query in the query list to create a general-purpose nonfiltered query for use with the services table. The system automatically prompts you for a file to use as the basis of the query, in this case the services table.
To add other files, you choose an icon from the speedbar. Once you've decided how files in the query should be related, you make the connection by dragging
from the parent file to the child file. When you do, a dialog box appears in which you set the specifics of the relation, including referential integrity, which prevents the child records from becoming orphans if someone tries to delete the parent.
Form Designer
Since version IV, dBase has had reasonably good form-design tools. In the Windows version, these have been enhanced to make good use of the graphical interface and the program's object orientation. The Form Designer eliminates much of the manual coding that the older DOS versions of dBase required.
You can choose to create a form manually, or you can use the
Form Expert
, which can automatically fill in items in the Form Designer. You can create four types of forms with the Expert: columnar, form, browse, and one-to-many. The columnar and browse formats will be familiar to experienced dBase users. The form layout makes a best guess at laying out a form with the least wasted space, resulting in a
rectangular group of fields and labels. The one-to-many format is a columnar layout in which the Expert embeds subforms to display multiple records from a linked table. Such a form might review unbilled services for each customer prior to invoicing, for example.
I created two sample forms for the invoicing system: one to review and edit service records, and another to preview customer billings. I used the form layout for the service-record form and created a reasonably clean-looking layout that could be used for data entry or editing.
I found two problems in the resulting form, which was required to verify three secondary key entries (the customer ID, the service code, and the franchisee ID) during creation of a service record. But when I added these three fields to the form, they appeared as simple input fields like the others, even though I'd set up a relation to the corresponding file via those fields. Although you can delete the field from the form and replace it with a Combo Box, the Combo
Box doesn't let you enter a new code. Any Windows database should offer a form object with specific properties that provide access to a related file via both a pick list or a call to another form.
I was also disappointed to find that the form, which included about 35 fields drawn from an unfiltered query of four files, seemed slow to appear, even though my test machine was a 486SX with 12 MB of RAM. Scrolling through records was reasonably quick (although slow compared to, say, a DOS Clipper screen), but a move to the top of the file could take up to 10 seconds. The speed increased to roughly a half second after I rephrased the query. A change in the order of the records and indexes may have caused the improvement.
I did, however, like the automatic sizing of the form's design grid to match the font in effect. This seemed to be easier to work with than one of arbitrary size like that found in Microsoft Access.
The other form I created was for previewing billings. It employed the one-to-m
any format to display data from a query designed to show only eligible services for each customer. The Form Expert generated this without any problem, producing a layout with space for information about each customer at the top and a browse display of services below that. If designed properly, this base form would make it easy to manage service billings from a single screen.
What's on the Menu
If you are developing a full DBMS, the Menu Designer, which is a subfunction of the Form Designer, offers a simple tool for creating the menus you'll need. Once you call it, Menu Designer presents a blank space in the top left corner of an empty menu. You simply fill out the options you want, moving across to create a menu bar item or down to create items on a drop-down menu. In the latter, tabbing to the right creates a cascading menu item. Once you've established the layout, you can edit the properties of each item to make the menu operational. You can set the menus to replace the normal
dBase menu or to reside inside a form window.
Reports from the Field
Reporting functions in dBase for Windows are provided by a capable third-party package, Crystal Reports for dBase, which is almost seamlessly integrated with the main program. Like many band-oriented Windows report writers, it provides full control over formatting, such as multiple fonts, graphics elements, and report sections, with drag-and-drop ease. You can place any dBase field type in a report, including memo fields, graphics, and OLE objects (you should probably limit OLE objects, though, to those your printer can understand).
There's also good news for professional developers, who will be able to distribute applications freely with the $495 Distribution Kit. Also, a $10 ODBC socket kit facilitates access to ODBC data sources.
It appears that faithful dBase users have been rewarded for their patience. dBase for Windows preserves their years of investment but propels them firmly towards the fu
ture of database software. Its compatibility, Windows interface, and object orientation establish it as a big-league player right beside other popular DBMSes such as Paradox and Access. If Borland can resolve some of the speed problems (which may happen when a compiler appears), dBase could regain its status as a real killer app.
ABOUT THE PRODUCT
dBase for Windows $400
Borland International Inc.
100 Borland Way
Scotts Valley, CA 95066-3249
(800) 331-0877
(408) 431-1000
fax: (800) 408-0001
screen_link (50 Kbytes)
dBase for Window's object-oriented Query Designer lets you add tables and records to a query by dragging and dropping them. Here, the Query Designer is editing a query of two tables, with the equivalent code displayed in the command windows.
screen_link (47 Kbytes)
The Form Expert provides help in designing four types of forms. Here, the Form Expert makes a best guess at laying out a form in the least amount of space. In the window at right is the program code generated when the form was created.
Jim Carls is a consultant, developer, and freelance writer living in Memphis, TN. He can be reached on the Internet at
75035.3622@compuserve.com
or on BIX c/o "editors.'