Apptacular ColdFusion Builder Extension – Scaffolding

Scaffolding against a database has been done to death. But I wanted to take on some of the harder challenges. How do you act towards relationships? How do you handle one to many, many to one, and many to many relationships? How do you detect these relationships? This is especially important with the ORM features in ColdFusion 9. If we can detect these, and model our CFCs correctly we can save a lot of time by generating these CFCs with relationships included. Then if we scaffold on views that take these relationships into account, we can really turbo charge development.

I also wanted to take on a few key issues like paging and performance. Basically, I wanted paging to be easy. That meant wiring it up from the get go. I wanted performance to be usable. That meant writing common needs like column counts automatically in HQL for optimal performance.

So that’s some of what I’ve set out to do in Apptacular. I have a video below that shows off these features:

  • Scaffolding
  • One-to-many relationships
  • Many-to-one relationships
  • Many-to-many relationships
  • Paging
  • Counts

http://vimeo.com/moogaloop.swf?clip_id=8123992&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=00ADEF&fullscreen=1

ColdFusion Builder – Apptacular – Scaffolding from Terry Ryan on Vimeo.

Apptacular ColdFusion Builder Extension

I’ve been working on a code generation ColdFusion Builder Extension for awhile –

Hey wait, where are you going? Okay, I know, code generation is so passé, but stick with me here I have some cool stuff for you.

So. Code generation. Okay, I have a ColdFusion Builder Extension named Apptacular. It’s an application scaffolder that builds an application from a database. Pretty standard stuff. But I wanted to do something cool with it.

I started with how I handle overriding. Every scaffolder can create a default application, but where they start to fall down is when you want to override the defaults. A good example of this is form labels. The database field is “first_name” but you want the form label for that control to say “First Name.” Different scaffolders solve this in different ways. I went with the tried and true XML configuration file route. My previous experience with this type of development tells me that people NEVER edit the XML. It’s a pain. Okay, fair enough, but I’m using ColdFusion and ColdFusion Builder. I can create interfaces that allow you to edit your configs without looking at the XML. I’ve done that.

This feature allows me to do all sort of tweaks to the application. I can change label, sort order, and foreign key label fields. I can also change aspects of the application like where the CFCs are stored, how the services are created, etc. It uses XML, but you don’t. (Unless you want to.)

The next thing I tried to do is make the interface for the entire set of configuration tools look a little better than the default. I used the ColdFusion Builder Extension APIs ability to display a URL as an interface to handle this. So I sprinkled in a little HTML, CSS and images to make a pleasing, branded, interface for my extension.

Then I put a lot of work into data modeling correctly. I can detect relationships and build the proper ColdFusion ORM CFCs for it. I can get commonly used items like number of related items.

Finally, there are a lot of little features like virtual columns, authentication, and Flex services that I’ve added. I should have a few videos of this in action for you over the next week.

The code is not quite ready to share yet, but I wanted to get it out there for all to see, and if need be, comment.

Instant Code Review ColdFusion Builder Extension

Continuing on my quest to find cool and unusual ways of extending ColdFusion Builder, I stumbled onto this Rube Goldberg contraption of an extension. It came about due to severe jet lag in Sydney and a need to do something cool for cf.Objective ANZ.

So imagine you’re a freelancer who is no longer in an office, able to get instant feedback on a piece of code. I know the feeling. Wouldn’t it be cool if you could do that through the IDE? Well this extension will do that. Highlight a piece of code in your editor window, right click, and choose Instant Code review. A list of your currently online buddies will pop up, and you choose them and write out a comment. Your code and comment will be sent via IM. Your IM buddy can respond to it. That response will get written as a comment in your source code above the selected code. And just because I can, if you are on a Mac, the extension uses text-to-speech to creepily tell you “Your instant code review is done.”

So what’s going on here? Behind the scenes I have an IM event gateway running. You remember event gateways; we added them in ColdFusion 7. They allow you to have ColdFusion be an IM or SMS client among other things. I use that gateway to take code from the IDE and pass it along to your IM gateway. The gateway can also listen for IMs. When it receives the response from your friend, it uses a locally written queue file to match up the response with the file that generated the code review request.

Don’t take my word for it, here’s a video demo.

http://vimeo.com/moogaloop.swf?clip_id=7706690&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=00ADEF&fullscreen=1

ColdFusion Builder – Instant Code Review from Terry Ryan on Vimeo.

Now I don’t see this as a completely useful extension. It’s cool, but it might just be a bit flashy. But I wanted to highlight that despite the fact that we added a lot of features to ColdFusion 9, it still has all of the coolness of previous versions.    

Like what you see? Then check it out at RIAForge: Instant Code Review ColdFusion Builder Extension.

Thanks to Raymond Camden who endured testing this application with me, and spammed his buddy list because of it.

Google Language Tools Extension for ColdFusion Builder

I have become obsessed with ColdFusion Builder Extensions. I am convinced that no other single feature of the IDE is as valuable as this. (And I love the rest of the features too, so I’m saying a lot here.) The ability to leverage ColdFusion know-how and features into tooling is awesome. A lot of the extensions we’ve shown off have been about code generation. I think that’s important, as it is big part of the Builder story. We make you more productive, but you make yourself even more productive. Of late though, I’ve been focused on extensions that do more than just generate code, they use ColdFusion capabilities in non-obvious ways. I’ll be posting them over the next few weeks.

Here’s the first:

I created a language translator that allows you to translate content in the editor window to other languages. As a first pass, it only does English, French, German, and Italian, but as I experiment I will expand them. To use:

  • In the Editor window, highlight the content you want to translate
  • Right-click it to bring up the context menu
  • Choose Google Language Tools -> Translate

That should drop the translated content back into your editor, below the original content.

To build this I used a few different pieces. In the last Public Beta drop of ColdFusion we added the ability to grab highlighted content from the editor window in a ColdFusion Builder extension. I take that highlighted content and pass it to the server. On the server I pass it to a CFC that I wrote that consumes the Google Language API. It’s a JSON-powered webservice, so I used ColdFusion support for JSON to simply get at this data. From there, I can use a feature of ColdFusion Builder called “callbacks” to write the translated code back to the editor window. Specifically, I used the “inserttext” callback, which allows me to insert text at a specific line of code. I can use this to carefully place the translated text.

Possible use cases:

  • Translating HTML content to multiple languages
  • Translating code comments to your native language
  • Creating language packs for your applications

Sound cool? Check it out on Riaforge: Google Language Tools Extension.