Archives for posts tagged ‘code generation’

Strategies for Editing Generated Code

I’ve been working with C# and Java lately. The absence of metaclasses are sorely felt, because there are tonnes of boilerplate code which needs to be generated by the IDE to do any useful work.
Here are some of the strategies I’ve seen employed:

Netbeans uses protected sections, which prevents developers from accidentally modifying generated code
C# uses [...]

First Encounter with Genshi

I was playing around with code generation of some scaffolding-style code for CodeIgniter. Initially, python’s string interpolation operator % sufficed. As time progressed, it became clearer that resorting to a templating library buys me cleaner code.
Problem #1
The $ used by Genshi for string interpolation conflicts with PHP’s $variables.
Solution #1
After 10 minutes of source [...]