Joe Teases Model-Glue 3

Posted By : todd sharp Posted At : April 10, 2008 8:39 AM Posted In: Model-Glue, Code Generation, ColdFusion

0

If you haven't seen Joe Rinehart's preview of event generation in MG3 you should check it out. He also shows how MG3 handles SES URLs behind the scenes. The video is truly exciting to me. I can't wait to see more of MG3 at cf.Objective()!!

CFDdlUtils - Convert/Export Your Database To XML!!

Posted By : todd sharp Posted At : November 29, 2007 3:37 AM Posted In: Code Generation, ColdFusion

8

Ray blogged yesterday about using some cool features in ColdFusion 8 to create a backup of your database. I commented on that post that I had recently been looking into a Java solution called DdlUtils. I hadn't gotten the package completely working when I messed with it the other day, but thanks to a couple of Excedrin Migraine pills I took last night that kept me up all night I got some time to dig into this project a little more. I'll hijack some text from the DdlUtils home page to explain the project:

A Warning About Generated Code

Posted By : todd sharp Posted At : July 8, 2007 10:08 PM Posted In: Code Generation, ColdFusion

9

I was just working with a bit of code generated from Illudium when I ran into the following error:

Oops!
Message Bean creation exception in model.snippets.libs.libService
Detail Cannot declare local variable tag twice.:Local variables cannot have the same names as parameters or other local variables.

A quick look at the code showed me the following:

<cffunction name="createtag" access="public" output="false" returntype="model.snippets.libs.tags.tag">
<cfargument name="tagID" type="uuid" required="true" />
<cfargument name="tag" type="String" required="false" />
            
<cfset var tag = createObject("component","model.snippets.libs.tags.tag").init(argumentCollection=arguments) />
<cfreturn tag />
</cffunction>

My 'tag' table has a column 'tag' - so the generator does what it always does - made my bean with the arguments supplied to it. Unfortunately my decision to name both the object and the column 'tag' led to the duplicate variable naming and thus the error.

Thankfully I caught the error rather quickly (which gives me a bit of confidence that I'm starting to "get it").

Bottom line is - like many have said - don't rely on code from a code generator to work "out of the box". Make sure you fully understand what's going on before you simply plug it in to your app.

Getting Started With Code Generators - Part 3

Posted By : todd sharp Posted At : February 15, 2007 6:51 PM Posted In: Code Generation, Project Learn, ColdFusion

3

The next step in Project Learn is to evaluate another code generator. This blog post will focus on installing cfcPowerTools, a tool created by Tom Schreck. I'll quote a little from the tool homepage (which is a very nice page by the way - complete with an actual online working demo of the tool):

cfcPowerTools is a productivity tool used to jump start your development effort. cfcPowerTools is a code generator that offers the following:
  • generate CFCs from database tables
  • generate database table from CFC
  • batch generate CFCs from multiple database tables
  • generate HTML, FLASH, and XML data entry forms
  • supports round trip editing
  • getter/setter generation

Like the Illudium generator, cfcPowerTools comes with different templates that can be used for generating your code. The following templates come standard:

  • Model Controller
  • MACH II
  • Concrete
  • Simple
  • Default

A few differences from the Illudium generator are apparent before even downloading the tool. The first difference is that cfcPowerTools allows for 'managed' code blocks. The blocks are flagged as such and can be regenerated at any time. The second noticable difference is support for mass generation from multiple tables. This would certainly be a timesaver (and something that I'm positive Brian could easily add to his tool).

On to the installation. Like the Illudium generator the install is very easy. Just download the project and unzip to your webroot. No configuration is needed since cfcPowerTools utilizes the ColdFusion admin API - but obviously you'll need your admin password handy. Hit the tool in your favorite browser and enter your pass. That's it.

In my next post will get into the tool and create some code.

Getting Started With Code Generators - Part 2

Posted By : todd sharp Posted At : February 14, 2007 7:10 AM Posted In: Code Generation, Project Learn, ColdFusion

13

In the last post in the Project Learn series we installed the Illudium PU-36 Code Generator. This post will go into a little more detail and we will actually get into generating some code.

Before I get started I should give a quick mention that the actual application that we will be building in this series will be an extremely simple Content Management System (CMS). Essentially the system will have a users table, a pages table and a few other miscellaneous tables (tables for links, link targets, etc). I figured this would be the easiest way to dig into the code generators and framework while still being something that is actually a (hopefully) usable end product.

Getting Started With Code Generators - Part 1

Posted By : todd sharp Posted At : February 12, 2007 10:15 AM Posted In: Code Generation, Project Learn, ColdFusion

4

So the first post in my series will focus on installing the first code generator that I plan on evaluating. The Illudium PU-36 Code Generator by Brian Rinaldi. Rather then try to creatively come up with a better description then Brian's I'll just quote the description from the project page:

This project generates ColdFusion components (i.e. bean, DAO, gateway, service), ColdSpring XML, Transfer XML, and ActionScript Value-Objects using the admin api and database introspection. The front-end is built in Flex 2. The code outputted for easily pasting or saving into a project to allow you to get a headstart on some of the gruntwork of doing OO in CF. It uses XSL to generate the components and is designed to allow you to easily add to or modify the generated code. You can even create new templates that can be swapped out at run-time.

The first step is to download the tool. There are two options - vanilla (HTML) or chocolate (Flex - yummy). (OK, they're really not called vanilla and chocolate, but I'm taking some creative liberties). I've checked out both versions before - very briefly mind you - but for this go 'round I'm going with the super sexy Flex version.

Step 2 isn't much harder - install the generator. Again I'll quote from the project page:

1. Copy the contents into a directory name "cfcgenerator" under your web root

NOTE: If you need to place it elsewhere, a mapping should work, but you will need to edit your webroot\web-inf\flex\services-config.xml and set true

1. Set your ColdFusion administrator password as the value of adminPass in Application.cfm

2. That's it!

There was one minor tweak I had to make to get the flex generator to run. The Flex version zip is packaged as /cfcgeneratorFLEX - but some of the createObject calls point to /cfcgenerator. A simple global find and replace on cfcgeneratorFlex (and change the name of the root folder) seems to do the trick. I've filed a bug on this.

So now the generator is installed. Simple stuff that's for sure. In my next post I'll talk about getting into the tool and generating some code.

Update: After talking with Brian it seems that the version that I obtained from Google Code was old - the new and most recent version is available at RIAForge. You can find it here: http://cfcgenerator.riaforge.org/