Home Page   We Generate Your Software.
Products Services Company Technology Demo Contact Site Map Search
The Somusar/SoProTech[tm] Booklet Series
Volume IX

"Code Generation Somusar Style"

Printer friendly


Contents
1. Introduction
2. Reproducing a POC on Your Computer
3. J2EE Generator
4. .NET Generator
5. PHP Generator
5.1 Proof-of-concept (POC) Information
5.2 Description
5.3 PHP Generator: Database Access Layer
5.4 PHP Generator: Test Pages
5.5 SQL Generator: Building a MySQL database
6. Java (J2SE) Generator
7. Bare Bones Multitier Generator
8. XML Processor
9. XML Generator
10. API Generator Producing C and HTML
11. VisualBasic.NET Generator Draft
12. VisualBasic.NET Generator
13. XML to Java Generator
14. PHP/HTML Generator
15. Java and JSP DAO Struts Generator
16. Further Reading

Chapter 5 - PHP Generator

5.1 - Proof-of-concept (POC) Information        top

5.2 - Description        top

This compact POC faithfully reproduces the PHP/SQL code generated by Jack Herrington in his article "Creating Portable Applications with Code Generation", published on DevX.

Purpose of this POC and of the POC in the previous paragraph is to demonstrate portability of code generation at two different levels:

  1. Across different target platforms (.NET and a PHP stack, in this case), as already shown in Jack Herrington's article;

  2. Across different code generators, realized with different techniques: the same input model processed by two different generators produces exactly the same code.

Another purpose of this POC is to demonstrate the flexibility and adaptability of the Somusar/Code Generator Building[sm] service: the POC generator reproduces exactly the same coding style (indenting, naming convention for the identifiers) of the original code.

The generator of this POC produces SQL code that builds a simple database, a PHP database access layer for that database, and PHP test pages. The input model for the generator is provided by the same XML file used as input model in the aforementioned article.

All output files are generated from the input model file listed in the following table.

Table 11 - Input Design Files

File name Source code
input.xml View

5.3 - PHP Generator: Database Access Layer        top

Table 12 - PHP Generator: Generated Files

File name Source code
phplib/Author.php View
phplib/Book.php View
phplib/Publisher.php View
phplib/ssdb.php View

5.4 - PHP Generator: Test Pages        top

Table 13 - PHP Generator: Generated Files

File name Source code
php/Author.php View
php/Book.php View
php/Publisher.php View
php/index.php View

5.5 - SQL Generator: Building a MySQL database        top

Table 14 - SQL Generator: Generated Files

File name Source code
mysql/data.sql View
mysql/schema.sql View

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

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