November 21, 2008

Pages


Search Site


Topics



Archives

Tweets

Entries Tagged as 'Frameworks'

ColdSpring 1.2 released, website updated

September 12 2008 by Adam

Along with the long awaited 1.2 release of ColdSpring, the worlds best CFC IoC/AOP framework has a brand spanking new website, which looks great; and includes a total overhaul of the online documentation.

Congratulations to Chris Scott — manager of the Philadelphia CFUG, and project lead for ColdSpring — and the rest of the ColdSpring team. Looks like a job well done!

Posted in Frameworks | 0 comments

Best Practice: Separate App config from Framework Config

July 29 2008 by Adam

Best Practices is something that I don't think anyone, anywhere, ever gets 100% right. There's no "right" way to do everything. But we're striving to do things better all of the time, right?

For example, in the ColdFusion world we have Unit Testing frameworks like MxUnit, CFUnit, CFCUnit, and Selenium. I know Selenium isn't just for CF, but it does integrate nicely! Test-driven Development is all the rage these days, and while that's a good thing it's not for everyone and certainly something very difficult to "get right."

Consider that in a large project — one with 1,000 test cases — if you refactor some code that affects 10% of your tests, you have to re-write 100 test cases. This isn't to say that TDD is a bad thing… far from it! Just that there is no silver bullet, and that you always have to be thinking ahead to try and do things right the first time, and not repeat yourself.

This brings me to a change I recently made in Grub.

Grub uses the Model-Glue framework to, as I like to say, "code less and do more." In Model-Glue's XML config, we have an <include> tag that allows us to separate our config into logical sections to keep maintainability high. But did you know you can do the same thing with your ColdSpring XML config?

Well, not with out-of-the-box 1.0… You have to download the Bleeding Edge Release, here. The feature was first mentioned in November of 2006, when Jared announced that he had written it. It was then blogged by a bunch of other ColdSpring users, but I don't think any of them mentioned that it wasn't yet included in the official release except Mark Drew, and even then I don't think I picked up on that fact until well after my second or third reading of his post. I ended up reading this bug report that clued me in, after about an hour of trying to figure out why the necessary method wasn't where it should be.

After you download the BER and update your local copy of ColdSpring, you can add lines like the following to your beans XML:

<beans>
   <import resource="ColdSpring_MGConfig.xml"/>
</beans>

I used this code to separate out my Model Glue config — which will be constant in every environment, but different between them (debug, reload, allow event generation in dev; no debug, no reloading, and no generation in production or staging) — from my bean definitions, which change frequently as I work on the applicaiton. Now, with my ANT build script, I can build and deploy my project without ever thinking about config, and I know it will always be right because it will never change without me doing so manually.

I'm somewhat surprised that over a year has gone by and it's still not included in the official release. This means that I'm currently using two unreleased frameworks in Grub (the other being the Model-Glue 3 RC), and that I am going to have to include them both in the download to make it as user-friendly as possible.

Posted in Best Practices | ColdFusion | Frameworks | 5 comments

Model-Glue 2 Cheat Sheet

June 26 2008 by Adam

Someone by the name of Nando posted his Model-Glue cheat sheet to the Model-Glue discussion group. I took the time to clean it up and make it a little more readable, and fit onto two pages. I've printed it out as front and back of a single page, and keep it with my laptop for reference. I think I'll also add it to my sidebar for easy reference. Thanks to Nando for doing the leg work. I just made it pretty! Click the thumbnail to download the PDF.

Posted in Frameworks | Model-Glue |

Improve Model-Glue 3 Load Time: Remove Unwanted Helpers

May 30 2008 by Adam
I've been spending a fair amount of time playing with the latest Release Candidate of Model-Glue 3 lately, and I've stumbled on a way to vastly improve load time. One of the new features of MG3 is "helpers", which is an easy way to make UDFs available throughout your applications. It really does make working with UDFs in Model-Glue easier, but there's one problem: It comes packaged with hundreds and hundreds of them. In fact – almost every single UDF on CFLib! And especially on your development server, where you're likely to reload the entire framework on every request loading them takes a good long time. If you prefer to hand-pick which UDFs to include – as I do – you have a couple of options. The simplest is to edit your config/coldspring.xml file, and remove the reference to the packaged helpers: &amp;lt;property name="helperMappings"&amp;gt;&amp;lt;value&amp;gt;/helpers,/ModelGlue/helpers&amp;lt;/value&amp;gt;&amp;lt;/property&amp;gt; becomes: &amp;lt;property name="helperMappings"&amp;gt;&amp;lt;value&amp;gt;/helpers&amp;lt;/value&amp;gt;&amp;lt;/property&amp;gt; Now you can selectively put UDFs that you want to use into your /helpers folder and have access to them without having to tack an extra 10 seconds onto the load of every page.

Posted in ColdFusion | Frameworks | Model-Glue |

Making New Toys Play Nice: Model Glue 3 & Open Blue Dragon

May 27 2008 by Adam

If you're like me (a glutton for spiffy new technology, and even more-so when it's free) then you've played around with Open Blue Dragon, and probably the latest release candidate for Model Glue 3. Unfortunately, they don't play nicely with each other out of the box. In this post, I'll document everything I've done in order to make MG3 run on OpenBD.

For reference, I'm running the Jetty-server-included version of OpenBD on Debian, against MySQL — which, by the way, is an awesome way to get a development environment up and running in no time flat!

The first problem I hit was this error: Bean creation exception during init() of ModelGlue.gesture.modules.internal.generation.service.XMLEventGenerationService MG3 error on OpenBD

After a little searching around, I found this post on the Model-Glue discussion group, where the issue reporter was describing almost exactly the same issue, and the response by Dan Wilson was that MG3 requires some of the new functionality packaged with ColdFusion 8 — but that he had submitted a bug report for it in the MG bug tracker, and provided a modified version of the file in question that uses a work-around for the issue. I tried this file and it resolved my issue. Dan says that the resulting XML may not be very pretty, but this is at least a starting point and might be improved on. Once you've gotten that resolved, you'll find that Model-Glue is throwing errors while loading itself.

Model-Glue 3 includes something called "helpers" which appears to mostly be a collection of UDFs; and this will be where your errors are happening. If you don't intend to use any of the helpers (or can/will copy any needed functions into your application manually), you can just delete the .cfm files in /ModelGlue/helpers/ and skip the rest of this step. Otherwise, what you'll need to do is run each helper file as if it were one of your pages, individually, and resolve all of the errors it throws. I will include downloads for any files I modified for this post.

OpenBD has some functions defined (CharAt, listRemoveDuplicates, etc) that aren't defined in Adobe ColdFusion CFML — these you can just comment out — and you'll also find some syntax like !=, ++, <=, and % that will need to be converted to neq, mod, lte, etc. NOTE: The baked in functions that collide with UDFs may not work the same way as the ones you're commenting out, so be sure to either look up their documentation, or thoroughly test before you rely on them. I changed: StrLib.cfm, DataManipulationLib.cfm, and DatabaseLib.cfm (switched a cfscript-style comment outside of a cfscript block to a normal CFML comment). Once each of these files will run individually without error, try your index.cfm again and you should see everything up and running!

As promised, here are the three files I modified. Don't forget to grab the modified copy of CGCodeGenerator.cfc from this post. I see that these helper issues have also been logged as bugs, so hopefully they will all be resolved before a final version is released.

MG3 working on OpenBD

UPDATE 5/30: At this point, it looks like code generation just doesn't want to work on Open Blue Dragon. Sean Corefield responded to a post of mine on the model-glue mailing list about it not working, and says that Joe is aware of the issue (with another Java class used) and plans to rewrite the code without using these problem classes at some point. Hopefully we'll see them fixed before a final release.

Posted in ColdFusion | Frameworks | Model-Glue | OpenBD |