The <Gen-it> Manual

 

 

 

 

 

<Previous Next >

3. What kind of code can I generate?

What kind of code you can create depends on a couple of things. First of all the code that you are generating must have a strong correlation with your database tables. SQL statements are therefore the first candidates: Create Table statements and Stored Procedures that Insert, Update, Delete or Select records. Other candidates are Classes that are directly mapped to tables or classes that provide data access (do selects, insert, updates and deletes) on tables. This sort of code can be generated in any programming language.
When you want to generate code effectively during a project it's important to distinguish between two kinds of classes: Classes that are 100% dependant on the database and classes that are not. The total dependant classes can be generated again and again during your project, reflecting changes in the database design (changes do happen). Classes that are not 100% dependant on the database are usually generated only once during a project. They form a quickstart in your project and are usually changed during the project to reflect business rules or project specific requirements.
When designing your system you can keep this difference in mind so that you can maximize the amount of code that is 100% dependant.

How do I create a XSL template?
Creating a new XSL template requires some knowledge of programming and XSLT and a lot of effort and experimentation. Start with an example of the code you want to generate: a class that depends on one of the tables in your database. Then try to create a template that produces the same code. This means that sometimes you have to change the example code in a way that is easier to generate. Look at the samples provided in the <Gen-it> library to get a headstart. Most templates only consist of nested for-each Class and for-each Attribute loops that extract the needed information about classes and attributes.

Where do I get an XML parser and how do I use it?
This is the easiest part of <Gen-it> based code generation. Most XML parsers are available for free on the Internet. The Microsoft MSXML parsers ship with Internet Explorer 5 and up. Look at our links page for other XML parser links. For instructions on how to use them you'll have to look in the documentation that is provided with the individual parsers.

An alternative is to use the <Gen-it> Transformation Manager that uses the Microsoft parser. The Transformation Manager can be found in the download section of this site.

 

<Previous Next >