Using RAD development tools
and object orientation in business application development
 

Which is the best strategy for buildng a Windows program? Being a developer using the Delphi tool, I must take a stand on that question.

The Delphi programming tool of Borland in itself certainly represents the object oriented mode of application development. However, planning an application build-up in Delphi is not always a simple task. This is because the Delphi tool box invites you to quick solutions, based on the tools available in it. A more thorough object-oriented approach with the specific application planned will partly compete with the 'tool box approach'.
 
 

On the market we find some products that offer enhancements to the standard Delphi component library. I will here mention two that I have some knowledge of.

InfoPower is a package of enhanced Delphi components, basically "offering more of the same thing" like more button types, tablegrid types, etc and more options within standard components. In my view add-ons like this one add extra functionality sometimes asked for, but they do not address the central question: How to improve efficiency in coding by better structuring and better adaptation to the needs of a particular class of applications.

BoldSoft offers an enlightened view of the object orientation problem by delivering a complete application generator, that also contains an embedded formally described model. The model may be created in a system like ROSE, and can then imported into the BoldSoft tool. The weakness of this solution is that it may be too standardized. In particular, the data base interface is not particularly developed to meet more complicated multiuser cases.
However, the extension to include the modeling in the system is of course principally correct.

In real production life, I think that a number of non-automatic programming efforts will be needed, based on deliberations of the planner:

In my experience, the following types of efforts are beneficial:
 

A)
Isolate objects in the user interface that normally would be built by several Delphi standard components and make classes or drop-down components for these. If used in several places, this work immediately pays back. Especially when the component encapsulates logic or data base access, the main part of your project code may be permanently relieved from large chunks of uninteresting code.

Example: I made controls consisting of two or four comboboxes that performed a stepwise selection of categories in a database. The database access and varying input and output options for usage was included.

B)
Concentrate on vital requirements in the application and build special classes or extended versions of standard Delphi components to meet those needs in a satisfactory way. This forces you to put quality in those parts, where it is most needed.

Example 1: All columns in table grids should become sorted if clicked upon. I used the TStringgrid and implemented the sorting, numeric and alphabetic. A DrawCell method adapted justification to left or right. A number of other properties were added, like "background" values attached to each cell. Thus, a considerable amount of tricky customer requirements were moved to the new component, which was also improved when needed.

Example 2: The data aware components offered in Delphi are seldom appropriate. Typically you want to control data fetch and data update according to the specific circumstances occuring in the the input form. And when you want to update the database, the SQL rules and multi-user environment conditions differ from case to case. In this perspective it is obvious why Borland did not make those components: They could not be done generally.

Example 2 touches a more general problem: The need to take care of some intermediate data handling yourself. You must often make a number of classes, that keep data in internal memory, while your application handles it.

If the application uses the TStringgrid, data classes using TStringlists and TLists to store data are especially attractive. Since a TStringGrid basically is a list of TStringLists, you can use a multitude of ways to assign or set pointers, in order to transport data between data storage to TStringGrid display.

Essentially, I say that you will build your own ‘TDataSources’ components.
 

C)  If within your ability and your resources, refine your planning of the project by designing a multi-layer structure, representing a profitable compromise between abstract object-orientation requirements and the RAD-tools and techniques offered in Delphi.

The ideal application solution typically contains a user interface layer, a central operations or business-rules layer and a bottom layer of data base connections.

This approach is not supported by the Delphi toolbox as it is, rather on the contrary. The BoldSoft application generator contains an implementation of it.

The trick that can be used to implement the separation of the three layers in a general way, is a Windows message system. Messages are of course supported by Delphi (as is in principle any Windows API operation).

Even if the mulitilayered ideal case is ruled out, since it may imply an unrealistic amount of programming work and a total replacement of the RAD-toolbox with original Object-Pascal code, you might find a few salient points in the application structure, that might be of vital interest to implement in a user-interface-independent and/or data-access independent manner.

Such investigations might also have the spin-off effect that the specification of the user interface improves. It might happen that alternative interesting user interface options are found or that the specification can become changed in a moderate extent to better suit an efficient design.
 

 
Conclusion:

The rationale of all this is that realistic object orientation work pays back immediately. Use an economical compromise between the Delphi RAD-toolbox and own Object-Pascal programming.

An own production of application-adapted classes, that usually sets off from a Borland-supplied component or class, gives better result than using general Delphi add-on packages.

 
[Gunnar Sommestad  1997-12-29]