Hi, recently I am working on a code generation tool.
I have a description file, say, properties file,
I generate method skeleton, programmer could add details into it.
Now, the problem is coming in. If I add one more new method to properties file, generate coding, it will overwrite/delete the method detail added by programmer, how could I avoid this? I want to insert a new method signature into that file.
Generate a class with abstract methods out of the code generator. Developers never touch this code because it will all be replaced by the next gen. You could even generate compiled classes into a jar and never let them see the source.
Instead developers extend the abstract class and override all the required methods. If a new gen adds a method, the next time they open up the concrete class the IDE or compiler will complain that there are missing methods. It's nice to have the tools working for you instead of against you!
Is that something you can do?
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Joined: Jan 29, 2003
BTW: Look into the XMI standard for expressing UML models in XML. You might be able to model your objects in a graphical UML tool, export XMI and then generate your code from there. Our code generator is actually an XSL style sheet working XMI simplified (by a proprietary tool) into a more easily consumed XML grammar. Add "visual modeling" and "standards" to your sales literature!