Using ArrayObjects and Polymorphism to       Reduce Code Size in      CA-OpenROAD

By Ted Mittman
Object Services Corp.

Two of the nicer features of CA-OpenROAD are the support it provides for populating arrays directly from SQL queries, and the ability to display an array directly to a TableField.  If you've ever written applications in a 3GL using a database API such as ODBC, you may also appreciate how easy these features make it to program user interfaces to manipulate multiple objects in a database.

At Object Services, we have developed a tool called ORION, which facilitates development of OpenROAD applications.  ORION can generate user classes directly from a database schema.  In addition, it simplifies the creation of database tables and indexes.  Together, these features enable developers to quickly implement physical database schemas identified during analysis and design, and then generate OpenROAD classes for them.  ORION has a host of other code generation capabilities, but this in

this article I'd like to focus on one called the datalink.  A datalink is a pair of OpenROAD user classes that provide set and tuple operations for a single database table.  Typically, ORION is used to generate a datalink for each table that an application interacts with.  Our experience with datalinks has led us to some ways to improve our code that you might find useful as well.

A code generator can make it easy to add new features to a program, but it brings with it the danger that opportunities for inheritance and code sharing can be overlooked.  The potential result is code that requires more work to maintain, more time to load into memory, and more system resources to execute.  To avoid this we always look for ways to reduce the amount of code in our applications.

The remainder of this article describes one technique for counteracting "code explosion" by enabling classes containing collections of objects to share segments of code.  The approach is especially well-suited to code that resides in an
abstract class-- one used only as a super class for other classes, and never directly         Continued on page 4                         

previous page first page next page
Back to the Members-Only Home Page
Back to the NAIUA Home Page