Progress Programming Tips

By Rod Gaither (rdg@worldinfo.com)


PPT-16  Creating persistent procedure libraries

Tip:

Now that we have internal procedures and persistent procedures we can
make some moves to improve the location of code that needs to be used
by multiple programs.  One such technique is to create a single
persistent procedure that is a library of internal procedures.  The
broker.p program in the ADM is an example of such a library of related
functionality.  Many of the procedures included in the broker were
originally in the templates or method libraries.  As part of the
review process for existing programs it is a good idea to identify
procedures that can be separated from their context somewhat or
generalized enough to be called from multiple places.  Taking these
procedures to that next level and moving them to a separate program
reduces the amount of code in each instance, thus improving
performance and the general organization of the application logic.

Once you have a library program you need to have access to it.
This requires you to know the HANDLE of the program once it has
been run persistently.  The ADM takes the approach of defining
a new global shared variable to make the broker handle available
to any program interested.  For a library as critical as the
broker this is a reasonable technique.  For libraries that you
load and unload based on application requirements you may want
to explore other options.  Some of these options are.

Finding a persistent procedure at runtime (PPT-8)

Using special initialization logic to run and assign a local
handle variable.

In the ADM let a container do the initialization and provide
the handle either via a procedure or attribute to other
procedures.

Wisdom:

Premature optimization is a fools errand.

Rod Gaither                  | rdg@worldinfo.com
World Information Systems    | (910) 333-2580  Voice
Greensboro, NC               | (910) 333-2584  Fax