Thursday, July 31, 2008

Neat CFC timesaver for hacking

Once your Model Glue apps get bigger, it can take quite a while to reload the app each time you make a change.

There is a simple trick I have been using with Model Glue controllers for a while, a CFINCLUDE inside a function is still dynamically evaluated per request and isn't cached from startup like the controller CFC.

Just move your CFML logic into another file, CFINCLUDE it, hack away for a while and then copy back in once you have finished. I avoid a lot of framework reloads this way.

2 comments:

Dan Wilson said...

That is a pretty good idea Zac. I must say the amount of time required to reload my MG applications has dropped to pretty much nil with CF8 and the more powerful hardware...

DW

Larry C. Lyons said...

One problem with this is that using a cfinclude in a function exposes all the private variables (those scoped with var) to the full cfc. So that can cause other problems.