May 04, 2005

CodeGeneration

It is well known that number of bugs is nearly constant if calculated per thousands of lines of code. So less code we have, less bugs eat our time.
Hence, we need to write programs on high level language. It gives us more functionality with less number of code lines. Unfortunately using highlevel language is not possible sometimes.

Another solution is just generate your code! Codegeneration is very interesting thing. In our company we started with generating lexer&parser for our game scripts. For theese purposes we use ANTLR already for several years. ANTLR is a"language tool that provides a framework for constructing recognizers, compilers, and translators from grammatical descriptions". It is good.

One more helpful codegeneration solution is automatic binding code between different programming languages. You can find a lot of different tools on http://www.codegeneration.net/

You can also use popular feature of generating classes from UML diagrams. Many modern programming frameworks give you this feature.

Some time ago we found interesting project called cog. It is tiny tool that allows you to write metacode on python right in your source file! Metacode is just "code that generate code". Using this tool is very promising.

No comments: