Home Page   We Generate Your Software.
Products Services Company Technology Demo Contact Site Map Search
Please note: this document is currently under revision.
The information herein contained, while still valid, does not reflect the latest state of the described technology.
The Somusar/SoProTech[tm] Booklet Series
Volume VIII

"somusar/tjpp: User's Guide"

Printer friendly


Contents
1. Introduction
2. Overview
2.1 Architecture
2.2 Usage
3. Installing tjpp[tm]
4. SimpleClass Example
5. ComplexClass Example
6. Running a Test
7. Exercise: Improving Multitier Code Consistency
8. Contacting Somusar
9. Further Reading
Appendix A - tjpp Directives and Macros

Chapter 2 - Overview

Somusar/tjpp[tm] is a Java[tm] pre-processor and code generator featuring the following functions:

  1. Property-oriented directives to define class properties and generate code related to the list of properties;

  2. File-oriented macro definitions;

  3. Inclusion of header files, with or without processing of their contents;

  4. Conditional generation of code blocks;

  5. Compact directives for boolean assertions and variable tracing print-outs.

With the only exception of item #4 in the above list, all tjpp features are implemented as textual macros and are thus open to any user-defined customization.

Tjpp fits particularly well in text-editor and command-line oriented development shops, allowing to reduce, insulate, and factorize repetitive code blocks and coding practices into parametrical user-defined macros that allow to quickly generate and assemble Java[tm] source files, or parts thereof.

The main advantage of tjpp is the reduction of redundant code, that can be transparently generated and re-generated by means of pre-defined directives and user-defined parametrical macros at file-system level.

Another advantage is the possibility to insulate in external macros syntax constructs subject to change as Java evolves, as shown by directive enumeration. When the new construct becomes officially available, the required changes need be applied only once in the macro, and all ".java" files using that construct can then be regenerated, thus providing higher flexibility and consistency.

To avoid introducing additional constructs in the Java files, tjpp translates ".tj" files into ".java" files, thus leaving untouched the subsequent steps of the software development and management cycles. Adding the ".tj" to ".java" translation to a command-line oriented software production chain should be not an issue.

2.1 - Architecture        top

Tjpp is a thin shell or ".bat" wrapper around Tefigel, accepting one input file (a ".tj" file) and producing one output file (the corresponding ".java" file). Tefigel is a slim executable file, currently available for Linux®, Mac OS® X, and Windows®. Tefigel is a scripting language expressly designed for code generation. "Tefigel" stands for text file generation language.

The Tefigel code implementing all tjpp's macros and directives is kept in directory "tjpp_lib", while the header files (extension ".tjh") are stored under directory "tjpp_include". Note the clear separation between macro files and header files: each tjpp macro resides in exactly one file under "tjpp_lib", and header files under "tjpp_include" do not define any macro.

2.2 - Usage        top

After installing tjpp as described in the next chapter, to run it type

   prompt> tjpp YourClass.tj
   prompt> tjpp subdir/AnotherClass.tj
which will produce "YourClass.java" and "subdir/AnotherClass.java" respectively.

Note that each run will overwrite the generated ".java" file, unless you set TJPP_BACKS_UP_JAVA to true in file "tjpp_include/tjpp.defs" to have tjpp save a time-stamped copy of "YourClass.java" into (for example) "YourClass.java-Dec02-12.39".

Tjpp has no command line options or flags. In particular, there is no equivalent to the C/C++ -DSOME_FLAG=some_value or -Isome_include_path preprocessor options.

All tjpp's error and warning messages output by Tefigel are described in "Somusar/SoProMach[tm]: User's Guide ".

[Previous chapter]    [Next chapter]    [Back to top]

http:// www.somusar.com  / doc  / booklets  / tjpp_manual  - Powered by SoProMach
Copyright © 2003-2012 Somusar - Trademarks - Legal - Privacy - Webmaster