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 I

"somusar/SoProTech: An Introduction"

Printer friendly


Contents
1. Introduction
2. Overview of SoProTech[tm]
3. Software Production Using SoProTech[tm]
4. Software System Layers and Pillars
5. Multifacet Software Entities
6. Software Molds
7. Generatable Files
8. The Somusar/File Generation Scheme[tm]
8.1 Applying the File Generation Scheme
8.1.1 Sample SQL File Generation Scheme
8.1.2 Sample Java[tm] File Generation Scheme
8.1.3 Sample HTML File Generation Scheme
9. The Somusar Languages and Language Processors
10. Structure of a SoProTech Project
11. Further Reading

Chapter 8 - The Somusar/File Generation Scheme[tm]

The bridge between entity files and molds on one side, and generated files on the other, is realized by the File Generation Scheme, applied by the SoProMach.

It lies outside the scope of this tutorial to discuss in depth this production scheme: nonetheless a short description is useful for a better understanding of the mold structure.

The Somusar/Software Production Technique[tm] defines the following six hierarchical levels for the production of a software file in the context of a software development project, independently of the language used for the output file:

  1. Project: the repository of entities and molds, the latter containing the set of project conventions and generatable files for the target software system;

  2. Logical block: the layers and pillars of the target software system, corresponding to the five facets of a Software Entity, namely CORE, DB, LOGIC, UI, DOC; the project molds, collectively referred to as the project mold kit, are divided in five groups (five directories), one for each logical block;

  3. File: a generated file, resulting from applying the generalized File Generation Scheme - implemented by a mold - to the specific features of an entity; the generic structure of a generatable file consists of a header, a sequence of generatable blocks, and a trailer;

  4. Step: a subset of all production actions required to generate a file; each step produces one generatable block;

  5. Collection: the input unit of work for a step, consisting of one or more entity fields;

  6. Entity fields: the basic building block of an entity, defined by an identifier, a type, and a label.

The File Generation Scheme properly said is defined as levels 3 to 6 in the above list, whereas level 2 specifies the logical grouping of Software Molds with respect to the software system layers or pillars.

In short, the SoProMach proceeds as follows when generating a file:

  • It loads the project and logical block levels of this scheme, to acquire all relevant project-wide and block-specific conventions that need to be followed within the generated source code;

  • It navigates through the file level of the scheme, sequentially applying all steps defined by the mold for the given type of file;

  • During each step, it processes either the collection defined as target by the mold, or all collections defined by the entity file in the section corresponding to the current logical block;

  • For each processed collection, it processes all fields belonging to the collection, according to the sequence used by the entity designer to define that collection in the entity file.

The hierarchical structure of the File Generation Scheme ensures a high degree of flexibility to the SoProTech: for example, a new generatable block can be added at any time in any position of any given mold by simply creating under the mold directory a new subdirectory with a numerical identifier, corresponding to the new step for the new block; the SoProMach will automatically apply the scripts of the new step the next time it is activated.

8.1 - Applying the File Generation Scheme        top

The figures and code sample in the next paragraphs show the mapping between the File Generation Scheme of three molds, and three files generated by the SoProMach applying those molds.

8.1.1 - Sample SQL File Generation Scheme        top

The illustration below shows the relationship between the structure of mold "DB/mold1-.sql" and the contents of file "business/DB/customer.sql": the header and trailer of the file are produced at the beginning and at the end of the molding stage, respectively; two generation steps within the mold process collections DB.table and DB.pkey respectively.

Figure 15 - File generation scheme of "DB/customer.sql"
Figure 15 - File generation scheme of "DB/customer.sql"
Enlarge

8.1.2 - Sample Java[tm] File Generation Scheme        top

The following code example describes how the File Generation Scheme of mold "LOGIC/mold1-.java" produced source file "company/LOGIC/Employee.java".

Code Example 7 - File generation scheme of "LOGIC/Employee.java"
The mapping between the mold structure (file header, generatable blocks, file trailer) used to generate this file and the contents of the resulting file is as follows:
  • The file header script from the mold produced lines 1-13;

  • Step #1 produced line 14, with the import statement for parent class Person, which is the only member of collection parent in entity file "employee.ef";

  • Step #2 produced lines 15 and 16, which are the import statements for embedded class PersonInfo and related class Department;

  • Step #3 produced lines 17-27, that contain the class declarator and the Java implementation of the Sisendel enum position;

  • Step #4 produced lines 28-32, that declare the members of the Java class; these members correspond to the fields of collection class in section LOGIC of entity file "employee.ef";

  • Step #5 produced lines 33-81, with all customary Java get and set methods;

  • Finally, the file trailer script produced line 82.

Source code - File "company/LOGIC/Employee.java"
    1      /*
    2       * This Java class generated by somusar/SoProMach[tm].
    3       */
    4      
    5      package com.somusar.entdemo.company;
    6      
    7      /**
    8       *   Class Employee:
    9       *
   10       *   An employee, some related information, and the 
   11       *   department s/he works in.
   12       */
   13      
   14      import com.somusar.entdemo.persons.Person;
   15      import com.somusar.entdemo.persons.PersonInfo;
   16      import com.somusar.entdemo.company.Department;
   17      
   18      public class Employee extends Person {
   19      
   20          // Map enum 'Position' onto an int with a set of values
   21          public final int PRESIDENT          = 0; // President
   22          public final int VICE_PRESIDENT     = 1; // Vice-president
   23          public final int MANAGER            = 2; // Manager
   24          public final int ADMIN              = 3; // Admin
   25          public final int SALES_REP          = 4; // Sales rep.
   26          public final int ENGINEER           = 5; // Engineer
   27      
   28          private int          emplId;             
   29          private PersonInfo   info;               
   30          private String       deptDeptId;         // relationship to Department
   31          private int          position;           // enum 'Position'
   32          private double       salary;             // range 0-1000000
   33          
   34          /*
   35           *   Get methods
   36           */
   37      
   38          public int getEmplId() {
   39              return emplId;
   40          }
   41      
   42          public PersonInfo getInfo() {
   43              return info;
   44          }
   45      
   46          public String getDeptDeptId() {
   47              return deptDeptId;
   48          }
   49      
   50          public int getPosition() {
   51              return position;
   52          }
   53      
   54          public double getSalary() {
   55              return salary;
   56          }
   57      
   58          /*
   59           *   Set methods
   60           */
   61      
   62          public void setEmplId( int emplId ) {
   63              this.emplId = emplId;
   64          }
   65      
   66          public void setInfo( PersonInfo info ) {
   67              this.info = info;
   68          }
   69      
   70          public void setDeptDeptId( String deptDeptId ) {
   71              this.deptDeptId = deptDeptId;
   72          }
   73      
   74          public void setPosition( int position ) {
   75              this.position = position;
   76          }
   77      
   78          public void setSalary( double salary ) {
   79              this.salary = salary;
   80          }
   81      
   82      }
	       

8.1.3 - Sample HTML File Generation Scheme        top

The next figure shows the mapping between the structure of mold "DOC/mold1-.html" and file "company/DOC/company.html". Again, the header and trailer of the file are produced at the beginning and at the end of the molding stage, respectively; three generation steps within the mold process the list of entity fields (1), the function members (2) and the enumeration fields (3).

Figure 16 - File generation scheme of "DOC/company.html"
Figure 16 - File generation scheme of "DOC/company.html"
Enlarge

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

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