CFML, Clojure, Software Design, Frameworks and more...

Entries Tagged as grails

October 21, 2013 ·

The cf.Objective() 2014 Call for Speakers is open until November 1st so you have just under two weeks to submit your topics. You can also vote for existing topic submission at that same link.

Right now we've only had two general CFML topics submitted (and seven ColdBox-related ones!) but there's a good number of JavaScript-related submissions - and remember that cf.Objective() has a dedicated JavaScript track in js.Objective(), as well as a mobile/front-end track so it's more than a CFML conference... but we still want to see a good spread of CFML topics!

And if you want to submit non-CFML web development topics that you think would appeal to a CFML / JS audience in terms of broadening their skills, you should do that too! Last year Scott Stroz did an excellent talk about Groovy on Grails, and I touched on some advanced CFML techniques inspired by other languages in my polyglot talk.

January 04, 2009 ·

As "usual", I start the year with a round-up of the highlights of last year, based on things that I blogged. It's been a strange year for me. After (seven) years with Macromedia / Adobe and most of 2007 spent freelancing, I took a full-time job with a startup and hired some amazing CFers to be part of my team. I (finally) learned Flex (and AIR). I learned a new language (Groovy) and did a lot less CFML programming than I've done in years while at the same time joining first the Open BlueDragon Steering Committee and then the CFML Advisory Committee, as well as attending more ColdFusion-related conferences than usual (cf.Objective(), Scotch on the Rocks, CFUNITED, Wee Dram of Scotch, MAX).

December 23, 2008 ·

Liz has announced the first round of topics for CFUNITED 2009. It's an interesting mix of speakers - some old, some new - and a broad spectrum of subject matter.
After CFUNITED 2008, Liz has promised lots of changes and improvements and we already know that the venue is something special and an all-in-one location (addressing a bit complaint about the last few years' conferences). One of the new changes for 2009 is that a quarter of the content will be Flex/AIR related, acknowledging the growth and increasing relevance of these technologies to ColdFusion developers at large.
Some of the highlights (from my point of view) of the topics announced so far:

November 07, 2008 ·

I said that I'd blog about a couple of painful lessons learned and that's a bit overdue. Sorry, I went to Holland for a week! However, here's one of those lessons learned...
If you work with containers in Java (collection classes), you'll find that they have a contains(obj) method. The idea is that you can quickly check whether a given object is already in the collection by saying:

if (myCollection.contains(myObject)) ...

In many cases, you'll find this "just works" because contains() has the same idea of "equal" that you do for your objects. That is, it checks whether that exact same object is a member of the collection. Unfortunately, there are situations where "the same" object might be a separate instance that just happens to have all the same data (or at least the same key data). That can happen pretty easily when you are working with an ORM (like Transfer - although in our case it's Hibernate). You may be manipulating an object with, say, id = 783 and ask the ORM to load it from the database (or cache) so you can work on the "original" object. If the object you were working with has become disconnected from the ORM's cached version, you will now have two instances of the "same" object. They are "equal" as far as you are concerned but contains() will not consider them the same and you might be surprised to see it return false when you know the object is in the collection!
This happened to me. My unit tests all passed but they had no disconnected objects. The real application began to fail and it took me a while to realize why.
For me, objects are "equal" if their id properties are equal (and they are the same type of course). In my Groovy domain objects, I define equals() to specify this behavior and Groovy conveniently calls equals() when I say objA == objB. Operator overloading is very useful (and easy) in Groovy and it can help make your code much more readable.
Unfortunately (for me), Java's collection classes don't respect that when contains() is called.
Fortunately, Groovy provides a fairly simple workaround. You can use the find() method and a closure to specify the filter. find() returns the first matching object - or null if no objects match. myCollection.contains(myObject) can therefore be replaced with myCollection.find { it == myObject } or, if you want to be explicit, myCollection.find { obj -> obj == myObject }
Since CFML does not allow you to compare objects directly, you're always going to have to write your own equality method. That means that any collection-based operations you do must explicitly call the appropriate equality method so, hopefully, you won't fall foul of Java's very literal "equality" test for the contains() method. If you work across both Java and CFML tho', you'll need to bear this in mind.

September 07, 2008 ·

I'm already used to the magic that is Transfer and I can't imagine building a ColdFusion application without it. Adobe have said they're looking at integrating Hibernate into "Centaur" and showed some simple examples of how it might work in their keynote at CFUNITED (I expect we'll see more at MAX - you are going to MAX, right?). Hibernate is the de facto standard ORM for the Java world and it is very robust, scalable and feature-rich.
We've been using Hibernate for a while to manage the persistence of our business objects and that has driven us toward Groovy for those business objects since, right now, you cannot use Hibernate with ColdFusion Components in any meaningful way and we didn't want to write all the verbose code that Java would require.
A recent discussion on the Transfer mailing list has focused on how to model one-to-one relationships and why Transfer doesn't support them directly. This is one area in which Hibernate's features go far beyond what Transfer offers - and part of the reason for us to "switch" to Hibernate for future product development.
Another modeling quandary when it comes to persistence is how to handle inheritance.

August 10, 2008 ·

As a fun way to while away a Saturday evening, I decided to look at Joe's Behavioral Analytics backend code to see if I could create a Flex-based AIR application that talked to services written in Groovy. There's not really much documentation out there to help so it was a very hit and miss experience but eventually I had a simple AIR application making a RemoteObject call to a Groovy class and getting data back. I'm going to have to talk to Joe about cleaning up the installation I've ended up with but here are the highlights (and I'll blog more about this once I have all the pieces cleaned up):

Create a Dynamic Web Project in Eclipse and then unzip BlazeDS into it (per the BlazeDS installation docs). Add Spring and the flex.samples.factories.SpringFactory Java class. Configure Flex Remoting according to Lin's instructions to add the Spring factory:

February 11, 2008 ·

Most of us know by now just how easy it is to write Flex applications backed by ColdFusion. Adobe have done a lot of work to ensure that integration with ColdFusion is seamless. It's very impressive.
Browsing through the Grails site, I noticed they have a plugin for Flex so I figured I'd try it out.
Following the instructions, I installed the plugin (grails install-plugin flex) which took a fair while to fetch the plugin from the codehaus.org site and build it and install it into my project. Then I created a service class - a regular Groovy class - with just this one additional line:

static expose = [ 'flex-remoting' ]

It had a method, hello(), that returned a string.
Then I put my main.mxml file in the web-app directory of my Grails project with these lines inside the mx:Application tag:

You don't need to build the project. You don't need to set any paths in FlexBuilder. Just create the MXML file.
Then I hit the MXML file in my Grails app:
http://localhost:8080/bookstore/main.mxml
Much churning ensued as the Flex app was compiled on demand and then up it came with the Hello button. Click. The return value from my HelloService.groovy hello() appeared in the text box.
It's a trivial app but it showed just how incredibly seamless the integration is. It uses the Web Tier Flex compiler for on-demand MXML compilation and it automatically manages the destinations for you.

February 10, 2008 ·

There's still a lot of buzz about Ruby on Rails and I've played around with it but I really don't like the Ruby syntax. I've tried a few different Rails packages and just find the experience... clunky. Lots of people are very excited about Rails and Ruby in general, especially with JRuby (Ruby for Java) now running Rails. In fact, Maxim Porges thinks JRuby has taken ColdFusion's place as the new web productivity layer for Java, after watching Charles Nutter demo JRuby at the acts_as_conference Rails conference recently in Florida.