Software Reality
Programming with
a dose of satire.

Site Map Search


Agile Development
 
Extreme Programming
 
Code Generation


Articles
Lifecycle
Design
Programming
Soapbox
Reviews
Cthulhu

Java Swing
Swing's greatest threat isn't SWT, it's Flash
Swing Survival Guide


 
Check out our ageing Reviews Section


Use Case Driven
Use Case Driven Object Modeling with UML: Theory and Practice
Get from use cases to working, maintainable source code. Examples use Spring Framework, JUnit and Enterprise Architect

Agile UML
Agile Development with ICONIX Process
A practical subset of agile development techniques, illustrated by example

Get Controversial!
Extreme Programming Refactored
Extreme Programming with a dose of satire
Available now:



Programming

Automated Code Generation (Page 3)

<< Introduction & Message Forum

<< Page 2 (What is a Code Generator?)


How do Code Generators Work?

As stated earlier, anything which is repetitive can be automated. Given the correct conditions, a lot of source code can be automatically generated - the programmer is then free to "fill in the gaps".

The question is, under what conditions can code be automatically generated?

For code to be generated, the following three vital areas must be 100% predictable and well understood:

1. The Design Patterns (the template to which the code will be produced)

2. The Domain Meta-Data (the topology that we are attempting to model in code, usually augmented with extra data provided by the developer)

3. The Domain Rules (the rules that dictate the structure and behaviour of the domain meta-data. This area is normally encapsulated in the generator program itself)

The data itself can of course be wild and unpredictable, as long as it fits within the above constraints.


Under what conditions are code generators especially beneficial?

Generators are best applied to a problem domain that involves many short, similar iterations. A good example is a database API, where the same design pattern is applied over and over to a series of database tables. The structure of each table might be unique, but the rules and conditions applied to each table are the same.

Under such conditions, it can even become quicker to write the generator itself than it would to hand craft the source code (not to mention the time saved if the database changes and the code must be rewritten, either partially or in its entirety).


>> Page 4 (Types of Code Generator)

<< Back to Programming

All trademarks and copyrights on this page are owned by their respective owners.
Stories and articles are owned by the original author.
All the rest Copyright © 1998-2008 Matt Stephens. ALL RIGHTS RESERVED.