Reusability and Velocity Code Templates
In the Standard Model, code templates are used to generate reusable Velocity code to reduce code repetition. A code template is a block of Velocity code, possibly containing place-holders, in the form of a string stored in an XML block. Such a block of code can be retrieved, processed, and executed to generate Velocity code. This technique can be used to reduce the amount of Velocity code required to process blocks by up to 30 percent. When a new block chooser is added to the data definition associated with pages, the required change to the format attached to DEFAULT can simply be an addition of the new identifier to the format, and no further Velocity code is needed. The code invoked to process the identifier and the macro invoked to process the block chooser can both be generated by code templates.
Wing Ming Chan
SUNY Upstate Medical University
Wing has a PhD degree in linguistics and an MS degree in computer science, besides an MA degree in Chinese. He loves programming, and spends a lot of time doing that as a hobby. He also loves classical music, operas, and ballets. He is happily married and has two dogs.