> > http://wiki.apache.org/myfaces/Code_Generation > 2) Generating base classes instead of templates from xml-config-files
For what it's worth, what you're describing here is the Generation Gap pattern. I've got a lot of experience using it with Cayenne over the years (and WebObjects years before that), and it's effective. It's sometimes painful to write and maintain your base class in a templating language, though, but once your base class is done, you don't need to mess with it again, so this is a one-time painful experience. And yes, you would typically generate an empty concrete subclass whenever one doesn't exist (the first time code generation runs for a given component). I check the code thus generated into the repository. I also keep the generated code in a subpackage called *.generated off the concrete subclasses's package.