MenuRainCode Engine for Informix 4GLNews

Typical uses

Typical uses of RainCode include:
  • Quality assessment for outsourced work. When a project is submitted to an external company, precise coding guidelines can be defined formally as part of the assignment. Such guidelines can then be checked continuously or at delivery time on the entire source code, rather than relying on random sampling. Besides, an exhaustive analysis provides a number of metrics that quantify the degree of compliance, which gives you a precise estimation of the amount of work required to achieve full compliance, rather than a binary answer.
  • In a migration project, performing large amounts of updates automatically, identifying the places that must be updated manually, predicting the total effort required for this manual update, and monitoring the progress of the entire migration. Examples of such migrations cover the replacement of a compiler by another, the change of platforms, TP monitor or database.
  • Integration in a compilation chain to ensure that every source code is compliant before it can even be tested. The standard language within an organisation or a project moves from plain Informix 4GL to Informix 4GL restricted by the coding guidelines.
  • Implementation of a complete metrics and quality strategy. This includes monitoring the quality and maintainability of all components continuously, predicting maintenance costs, detecting abnormal entropy within systems before it becomes a maintenance issue. Metrics, such as cyclomatic complexity of functions, can be performed on a daily basis.

The RainCode Engine for Informix 4GL is used to generate the RainCode Roadmap for Informix 4GL.

How does it work ?

RainCode actually reads the Informix 4GL source code and builds an annotated parse tree after a fully documented object model, including inheritance relationships (IfStatement inherits from Statement). A scripting language can then be used to walk through the parse tree, taking full advantage of the features provided by the object model. By using the parse tree rather than its underlying textual representation, RainCode can deal with cases far too complex to be handled by text manipulation tools such as Perl.

RainCode supports both procedural and event-driven programming, the latter being used for simple scripts, such as:

    ON GotoStatement DO
      OUT.WriteLn ('Goto statement found on line ', X.LineNr);
      END;
The example above issues a message whenever a goto statement is found.

The scripting language is a very simple dynamically-typed ALGOL-like language, and provides various features specifically designed for the purpose of manipulating parse trees:

  • Quantifiers:
           c := COUNT IN Root.SubNodes :- X IS Statement;
           OUT.WriteLn ('There are ', c, ' statements');
    
    The above example counts the number of statements and displays this count.

  • Annotations to add user-defined information to the parse tree
  • Convenient list and set-manipulation primitives
RainCode moreover provides several convenience features to ease the development of potentially complex source code manipulation scripts:
  • Access to the system resources (reading and writing files, spawning sub-processes)
  • Library of string and mathematical functions
  • Access to XML tree via the DOM API
  • Modularity, so that libraries of routines can be built, and reused in several scripts

RainCode is delivered with numerous documented scripts, which implement various checking and documentation functions. These can be used out of the box or be adapted to a specific environment. It also includes the entire script source code of the RainCode Roadmap.

Available information

The parse tree provided by RainCode includes the entire syntactical information (that is, for every component, access to its sub-components, the image of identifiers, whether optional keywords have been used or not, etc.), positioning information to be able to resynchronize on source code. Besides, it also includes semantic information, such as the variable an identifier refers to.

The patch mechanism

RainCode also supports a complete patching mechanism to perform changes on the source code. This can range from trivial cosmetic changes such as pretty printing to normalization issues such as replacing use of attributes by accessor functions.

Distribution

The RainCode distribution includes:

  • A binary executable for NT
  • Obfuscated source code for easy recompilation on most Unix platforms (tested under Solaris, Linux, AIX, HP/Unix)
  • A printed documentation set
  • The PostScript source for this documentation, so that additional copies can be produced conviently
  • The entire documentation, including the user manual and a reference guide, structured as a set of HTML files
  • Numerous thoroughly documented sample scripts



© 2002-2008 RainCode -- comments to webmaster@raincode.com