‣  JIOWA Code Generation Framework 

‣  JIOWA Test Data Generation

‣  JIOWA Webservice Turbo 

JIOWA Code Generation Framework

A new approach for code generation is presented. It consists of a powerful template engine which works quite differently from other approaches.

Templates are pre-compiled during automatic build of the IDE into so-called template beans (POJOs). By design, application logic is written in user-defined Java code which uses template beans for the data insertion process. Each template bean can render its contents to a text string by simply calling the toString()-method. If previously generated source files have to be updated, the code generation framework also offers support for protected regions which leave manually written text regions unchanged.

In the following, we list some of its features and continue with a quick introduction.


Quick Introduction

Example 1: Letter Example

Below we see a simple example template for a letter or email.

Templates are simple text files which can be enriched with template notation elements in order to work with parameters.

There are only two basic structures for parameters: variables and subtemplates. In the example letter, inline subtemplates are used, a special case of subtemplates. The red template notation elements are symbols only. There are no special keywords. The green identifiers can be chosen arbitrarily by the user.

The template is compiled during the automatic build process into a so-called template bean. The green text elements of the template become nested structures (classes, constants, ...) within the template bean class.

Parameters can be simply filled into the template bean as shown in the lower left part of the next picture. The text representation of the template bean Letter_jgt delivers the template text with inserted parameter values ("Smith", "Jenny Jones") and sub template instances (MrMs).  The text representation of sub template Mr via the toString()-method is "Mr."

The output of the toString()-method of template bean Letter_jgt is shown in the lower right of the picture below.

Example 2: Java Class Template

The next example shows a Java class template which uses two additional sub templates: Attribute.jgt & GetterSetter.jgt

The sub template structure identifiers like "foreachAttribute" can be chosen by the template designer totally arbitrarily. It does not matter if we write "pourChaqueElement" (french) or "fuerJedesAttribut" (german), or separate the single words with spaces as in "for each attribute".  This identifier is always compiled into the corresponding structure within the template bean with the same name and can be used for the (multiple) insertion of sub template instances.

The picture below depicts the translation of the Java class template into the template bean class via automatic build of your IDE.

The attribute template Attribute.jgt is rather short and consists of only two variable values: DataType,  AttributeName.

Getters and Setters are defined in the GetterSetter.jgt template which is compiled into the template bean class GetterSetter_jgt.

Insertion of values into the Java class template is performed in the same way as in the letter template example. The data can be obtained from any kind of model for which a Java API exists.

Download the code generation framework here …

Special Features: How to insert data into multiple templates in only one step!

If you want to see some unique features of the template engine you should check out the presentation below. The PDF version can be found here. 

Multilingual Templates: 
What if we have multiple templates with the same logical structure but just different visual appearance? 

In the picture below, we show letter templates (Letter.jgt, GermanLetter.jgt, FrenchLetter.jgt) for three different languages: English, German, and French. The templates consist of the same identifiers (Salutation), sub template names (Mr, Mrs), and variables (Name, ContactPerson). As we can see, they are compiled into almost identical template bean classes with just different names: Letter_jgtGermanLetter_jgtFrenchLetter_jgt.

In general, template beans with similar internal structure are suitable for automatic value propagation, i.e. the values as well as the sub template instances from the parent bean can be used for the child bean if they are not set explicitly. This works because the sub templates (inline & external), variables, and identifiers are (at least partially) the same in all of these templates. Using these templates, we just have to insert data only once and use the copy constructor (or parent constructor to be more precise) to re-use the values from the parent template bean. The implementation for our letter example can be seen in the next picture.

Automatic Value Propagation
Example 1: Java Class Template with External Sub templates and Includes

In the following, we explain the concept of automatic value propagation and its implications in more detail using some Java class templates. The Java class template of the next picture consists of some variables, some sub templates and one include statement. Using external sub templates and includes, the visual complexity of a template can be reduced significantly.

The sub templates (Attribute.jgt, Getter.jgt) and included files (Constructor.jgt, AttributeDeclaration.jgt) are depicted in the picture below.

The arguments of the constructor template are defined as shown below. They consist of the following templates: Argument.jgt & AttributeDeclaration.jgt. Variable initialization in the constructor is performed in the initialization template AttributeInit.jgt. In this and the previous picture the usefulness of includes become quite obvious. They are very suitable to re-use various template parts multiple times.

This Java class template is converted into a template bean Class_jgt via automatic build process of your IDE.

In order to explain the benefits of automatic value propagation, we have to look at the generator code where the template bean is used.

Example 2: Java Class Template with Inline Sub Templates
Value Propagation also works for templates which are constructed with inline sub templates.

In the following picture we show the code generator version for the template with inline sub templates. As we can see all values for the inline version can be inherited via parent constructor from the parent template bean.

Code Generator Output:
External and Inline Template Version

For both template versions (sub templates as inline code or external files), the result of the code generator output is identical.

Automatic Data Type Conversion
Furthermore, if sub templates (inline or external) are used as placeholders for data types, automatic value propagation serves as automatic data type conversion facility for about any platform (Java, C++, SQL, ..), i.e. you just fill-in the data for the Java template bean and can fill the C++, and or SQL template bean via parent constructor without having to take care of the data types. We will describe this in more detail in one of our subsequent presentations.

Download the template engine and code generation framework here …

⬆ Back to Top

JIOWA Test Data Generation

The test data generation tool can produce trillions of data items for realistic performance testing.

Other approaches often rely on numerated test names ("Thomas001 Muller058", ... "Thomas789 Muller910", ...) or even automatically generated cryptic names like "asdfljsdf kklhhjj", ... , "uzqwzurk iouwerhh". While this kind of test data is sufficient to test the base functionality of a system, this does not apply at all for testing the performance of realistic search queries, like finding all data items for a specific name. In particular, performance tests for phonetic search with cryptic names are obviously impossible if you want to find all similar sounding but differently written names. This is especially unfavorable, because a large amount of performance in software systems is spent on search queries. Thus, extensive performance testing for this use case is crucial.

This tool is able to create millions of different realistic names to address this problem.
Some statistics:

  • Around 100 million international different female & male name combinations.
  • Trillions of different name and city/street combinations.
  • Many cities from all US states and all German states (Bundesländer) in test data.
  • Countless name & address combinations for US and German addresses.

The software is written in Java and can be imported into any IDE as simple Maven project. In order to support various kinds of data formats, it is pre-configured to make use of the template engine of the JIOWA Code Generation Framework. Using simple code templates it is very easy to automatically generate project specific code enriched with random test data (classes, SQL scripts, configuration files, unit and integration tests, ...). 

Download the test data generation tool here ...  

⬆ Back to Top

JIOWA Webservice Turbo

Using this framework we can optimize the performance of each existing Webservice application within a SOA (service-oriented architecture) environment. No hardware upgrade needed! Depending on the granularity of your webservices and your current architecture, the speedup can be up to factor 20. The webservice turbo can be activated and deactivated during run-time without stopping the application. 

We offer a cost-free analysis of your webservices and present a prognosis on the possible performance gain. The price for our service depends on the speed-up factor we actually achieve. This gives you maximum safety that your project budget will be well spent and you definitively receive a significant return of investment.

Contact us here for the performance optimization of your web services!

⬆ Back to Top

©  JIOWA Business Solutions GmbH    -    Impressum