Progress Programming Tips
By Rod Gaither (rdg@worldinfo.com)
PPT-15 Using include files to maximize code reuse
Tip:
An old but still invaluable technique is to use an include file
to separate the function from the data for a code block. This is
especially handy due to Progress's static binding of table and field
names. In the early versions of Progress (v6 and before) we used this
technique to create our own browsers. By isolating the function of a
browser in an include file that took table and field parameters it was
easy to create browsers for different tables. We use this technique
less for complex UI behaviour and more for avoiding template cut and
paste syndrome now (v7+) but it is still incredibly useful.
If you find certain logic is required often it is a candidate
for an include file. Should you want to expand on the
technique later, say adding hooks to special debugging or error
processing it becomes very easy to make the improvement. Change
the include file, recompile. No need to touch lots of source and no
need to understand every program the feature is used in.
With the addition of preprocessor definitions you can even
reuse the same parameters in multiple includes to further
simplify and control the reference to static information.
Due to the large number of examples this tip is just an
introduction. Specific includes to follow later. :-)
Wisdom:
New paradigms are not necessarily better, they are just new!
Rod Gaither | rdg@worldinfo.com
World Information Systems | (910) 333-2580 Voice
Greensboro, NC | (910) 333-2584 Fax