Archive

Posts Tagged ‘CFTemplate’

Code generation with CF Template

July 17, 2008 Leave a comment

Continuing with the automation theme from CFUnited ’08, I attended Peter Bell’s session on his CF Template project.  This is intriguing to me since I code using Fusebox 4.1 and there are pretty standard templates we use regularly–qry_, dsp_, act_, and .cfc.

Currently, I’m gathering as much documentation on CF Template and code generation as I can get my hands on, starting with Peter Bell’s blog which contains several posts.  So far it sounds logical enough.  But from I what I gather, it’s like the game Othello; a minute to learn, a lifetime to master.  CF Template is available on RIA Forge.

At this point, I’m not sure which is the better starting point, the metadata or creating the template to generate code.  What I have found is that just thinking about the metadata can be an exercise in mental gymnastics.  I’m wondering if it’s best to take a current file such as a cfc, and just mark it up with everything that could be considered metadata.  Thinking in those terms, metadata that comes to mind is component name, function name list, arguments list, dsn, etc.  I’m a little worried that it will be quite difficult to create a generic enough .cft file that will work across applications.  Should an entire query (just the SQL) be a part of metadata?  How can I then pass argument(s)?  Should I put the query into the .cft file?  How then do I handle joins, group by, order by, etc.?  I’d really love to hear from some who have used CF Template for their experiences.  How did you go about compiling metadata and your .cft file?  All feedback is greatly appreciated.