Copyright © 2007 SoftVelocity, All rights reserved worldwide

The Template Registry

A template is a complete set of instructions, both Template and "target" language statements, which the Application Generator uses to process the programmer's input for application customizations and is then used to generate the "target" language (usually, but not limited to, Clarion language) source code. Clarion's templates are completely reusable. They generate only the exact code required for each specific instance of its use; they do not inherit unused methods. The templates are also polymorphic, since the programmer specifies the features and functions of each template that are required for the procedure. This means one template can generate different functionality based upon the programmer's desires. Once the developer makes a selection, it's stored in the Application tree.

When you are ready to generate the source code for the application, the Application Generator reads the template, substitutes the dictionary properties the developer selected for data references, inserts these into the source code stored in the template, interprets the control statements and other options selected by the developer, and according to the selections, it then outputs a source code file that contains the final product: source code that does what the developer specified, referencing the data elements chosen. The project system then compiles the application.

Clarion templates are highly configurable, interactive, interpreted, code generation scripts. A template typically prompts you for information then generates a custom set of source code based on your responses. Each template also contains embed points: access points at which the developer can insert their own code to execute in the midst of the code generated by the template. This allows for an unlimited degree of customization. Moreover, even if the developer changes the options in the template's design time user interface, the application generator will not overwrite the custom code placed by the developer in the embed points, when it next regenerates the application. The illustration below shows a developer placing code in an embed point:

Click to enlarge. No additional download necessary.

Even after generating a project, developers can continue editing the options in the application metabase, and regenerate part of the application without overwriting previous customizations. This makes ongoing maintenance easier than any other development system. This greatly aids businesses by minimizing what is often the most overlooked major expense in any software development project —application maintenance.

This ability to regenerate an application to reflect new template functionality or revised database schema without overwriting previous customizations marks a revolutionary advance for software developers. These developers have relied heavily on wizards supplied by rapid application development environments to generate user interfaces, and class libraries for application logic. With Clarion, these same developers can take advantage of a rapid application development environment that continues to provide the same wizards and shortcuts, only now the developers can rerun wizard functionality at anytime, and can implement class methods and property options through a design time interface customized for each piece of application logic.

There are several different ways to apply the templates, and remember that you can change the default behavior for any template, or create your own version:

  • Application Wizard: walks a developer through selecting the tables from the dictionary that the new application should view, edit, and maintain. The wizard examines the relationships between the tables, and creates a full application according to the default application paradigm. This paradigm starts with a top level browse (i.e., a listbox containing a page loaded view of all the records) of all the top level tables, with sort order selectable according to the existing keys. Selecting a record for editing brings up a default form for that record ( a “New Record” command displays a blank form with any initial values specified in the Dictionary pre-filled). For any tables having child relations to the top level record, a tabbed property sheet displays a list box of records from the child table, for the currently selected record. Selecting one of the child records displays an edit form for the child, and so on through all the relations. Reports are also generated, with options to sort by the existing keys. The default reports are simple columnar reports for each table.
     
  • Procedure Wizard: the procedure wizards allow the developer to create individual procedures
     
  • Embed Points: these allow “access points” within all the code that the templates generate, so that the developer can add custom code to that is combined with the template generated code. Embed point can be added anywhere in the template, allowing for an unlimited degree of customization. A developer can even make changes to the template, reregister it and regenerate the entire procedure, replacing the generated code. The illustration below shows the "generated" source code file. Code handwritten by the developer is appears within the development environment on the white background, while generated code appears on gray.

Some of the template "types" that Clarion includes:

  • Procedure Templates: generate procedures in an application, i.e., an entire task appropriate to attaching to a menu command or button, one which might be associated, for example, with opening a window, processing user input, and completing a task.
  • Code Templates: generate code for additional functionality into an existing procedure. The developer can only insert them within an existing procedure. A list of the available code templates appears from which to choose. These provide a quick way to insert code for a specific task.
  • Control Templates: place a related set (one or more) of user interface controls on a window or report, and generate the source code to provide the control’s specific functionality. A “Close Button” control template, for example, will provide a button and the code so that when the end user presses the button, it will close the window and provide all the necessary cleanup code.
  • Extension Templates: generate executable source code into one or more procedures to add specific functionality that is not tied to any window control, and which can even be tied to all the procedures within the application. ClarioNET, for example, exists as a global extension template. ClarioNET is SoftVelocity’s thin client enabling technology. By adding the ClarioNET template (and associated libraries) an existing client-server application can be delivered as a n-tier thin-client application.
  • Utility Templates: provide specialized functionality, e.g., providing a means of documenting the procedures within the current application so that the developer may easily generate a manual or help file.

 

 

 


Copyright © 2007 SoftVelocity, All rights reserved worldwide