close this bookVolume 1: No. 15
View the documentCorrections -- Monash job withdrawn; politics and PYI panels
View the documentNews -- DARPA reorganization
View the documentNews -- Congressional initiatives
View the documentNews -- Alan Salisbury; fuzzy logic at MCC
View the documentNews -- design industry
View the documentDiscussion -- design teams
View the documentDiscussion -- corporate life
View the documentDiscussion -- continuing education
View the documentDiscussion -- promoting yourself
View the documentTools -- newsletters
View the documentTools -- object oriented programming
View the documentDiscussion -- program templates

We all know the advantages of reusable code libraries, but some design professionals are now arguing that templates are better. A template is a program skeleton, with hooks for calling modules that do domain-specific tasks. Subroutine libraries are easy to maintain and document, but difficult to organize or index and to modify. (The Software Productivity Consortium, Herndon, VA, is working on this problem.) Templates provide a uniform style of user interaction (e.g., Apple's event-driven programming style) and are easy for programmers to use. Only a few general-purpose templates are needed, so the burden of finding and learning an appropriate template is quite small. (In the extreme case, a template becomes an application generator, 4th-generation language, or operating system.)

We need both, actually -- and perhaps expert-system rule bases as well. Templates are useful for controlling complex interactions with many parameters and control paths, such as data entry and validation. (A sufficiently general subroutine would be obese and hard to parametrize. Template customization take the place of knowledge-based compile-time optimization.) As a very simple example, consider how easy it is to modify a template for converting integer vectors to double precision, and how hard it would be to code a generic routine for efficiently converting any runtime-specified vector type to any other. On the other hand, there are times when optimized subroutines will be more efficient than hacked templates. [See John Keller, Military & Aerospace Electronics, 6/91.]