There are several packages on the market that can be used to generate apps based on templates. They all have strengths and weaknesses of various sorts. I've never used any of them, and now find myself using one to generate a multi-tiered app. I have the ability to edit the templates, so I can theoretically change the generation. However, in practice, I find that I can only make simple changes.

As an example, I was having a problem with a grid that looked like it would be simple to fix. I started stepping through the code, and eventually noticed something familiar, so I looked at the stack. Sure enough, the code was re-entrant, so I was going through the same set of functions for a second time. However, I also noted that the call stack was HUGE. In fact, the stack was something like this: A called B which called C which called D.....etc. until R called S which called T which called A which called B....etc. until R called S which called T which returned all the way back. That meant that the stack was nearly 40 calls deep. Some of those functions were essential, while others were there largely because a template has to function correctly for 100% of the cases, so sometimes you have to add something goofy that is unnecessary in 95% of cases, but is essential to the other 5%.

This leaves me nearly paralyzed when it comes to making changes. A call stack that deep, where much of the work is being done because a theoretical "other app" might need it, is beginning to appear to be impossible to maintain. Of course, I could simply alter the generated code, but if I was to start down that path, since there is so much extra crap, I'd never be able to re-generate, which defeats the purpose of using a code generator.

Basically, I'm totally frustrated by this generation after fighting with it for months. I'm making glacial progress, and sticking with it to be a team player, but progress is so slow and halting that it can barely be called progress at all. I've learned many languages, and written dozens of programs, and I think I'm at least capable, but this whole process is making me feel utterly inept.

What I'm looking for is anybody else's experience with template based code generation. Have you done it? How was it? What was good? What was bad?