Dynamic code generation with templates is intriguing, but beware of it drifting toward static code generation.
Here is an apt quote posted on the Perl XML mailing list on January 30 by A. Pagaltzis. http://aspn.activestate.com/ASPN/Mail/Message/3000448 " autogenerated code is evil. Don't hang that albatross on your neck. You need a way to abstract way the repetition, not a way to generate more boilerplate faster with less effort." Static code generation an instance of false laziness. You must learn the abstractions relevant to your favorite programming paradigm. Almost every mainstream programming language follows is object-oriented to some degree, so you can define a base class for the most general solution. Override virtual and base methods instead of submitting inputs to a code factory, which will leave you with dozens of copies of subtly different code. The reason that's not maintainable is because you will generally need to evolve your generic solution more often than your customized instantiations, and you really won't want to modify the common parts of every customization. Andrew Strader -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of klaushorsten Sent: Monday, July 10, 2006 3:02 AM To: [email protected] Subject: [Templates] TT as a Code Generation Tool Hallo, does someone use TT as a code generation tool? This is my aim. I am using Vim. I searched everything in Vim and this is what I thought is the best: http://www.vim.org/scripts/script.php?script_id=1311 My Problem now is, that I do not understand Perl (I understand PHP which is similar but not so sophisticated). I want also to have a DB connection to generate Code, which e.g. calls StoredProcedures. So I need the name of all stored procedures of a Database plus the name of its variables plus the types of the variables. So I can generate classes. I did this before. I am working with C# on windows. I have written a Vim plugin for coding in the TT language. If someone is interested, I can posted here. - This is what I can do for you. - Maybe somone else is interested in this theme. I have also contact with the author of Vimplate - maybe he is here also (Urs - bist Du da? ;-) Best regards, Klaus _______________________________________________ templates mailing list [email protected] http://lists.template-toolkit.org/mailman/listinfo/templates _______________________________________________ templates mailing list [email protected] http://lists.template-toolkit.org/mailman/listinfo/templates
