Glen Smith: Somersaulting into Grails
Glen is an Aussie Groovy Stunt Programmer, responsible for groovyblogs.org and Gravl, a Grails powered blog engine. He picked Grails since the early beginnings so you can bet he knows a trick or two when it comes to tweaking a Grails app. Enjoy!
[img_assist|nid=2195|title=|desc=|link=none|align=right|width=180|height=210]Q. Glen, how did you get into Grails ?
A. I was a Manning reviewer for the original edition of "Groovy in Action" (GINA). I fell in love with the language (and that book remains one of my favorite programming books of all time). There was a taste of Grails in GINA, and it looked really promising. I had been working on an SMS Gateway for a home project in Spring MVC at the time, and it wasn't going terribly well. On a few hours a week I was really struggling to stay focused and I felt that I was making virtually no progress. I had nothing to lose, so I thought it might be a good chance to take Grails for a spin. 40 hours later, CyaThen.com went live. It blew me away. At that point I realised I would never write a traditional Java web app again.
Q. What motivated you to write groovyblogs.org ?
A. Groovyblogs came about because I wanted to see how much I could build in 20 hours of Grails development. I figured that after a day job, study, hobbies and family, I could devote about 5 hours a week to Grails (and still can!). Since one month is about 4 weeks, which is about 20 hours of Grails programming, I figured I'd devote a month to building a Community-driven app in my spare time. Since my first Grails app took 40 hours (CyaThen), I was pretty sure that my second should be doable in that timeframe. It was a matter of coming up with an idea for a community site.
I've always loved JavaBlogs.com, and it seemed that our emerging Groovy & Grails community could really benefit from a similar service. It also had a pretty clear mental model for how things worked, so I didn't have to do too much thinking on the design. 20 hours later, groovyblogs.org emerged.
Q. You are an early adopter of Grails, how do you see it now that it has achieved 1.0 status ?
A. I remember writing an email to Graeme [Rocher - Grails project lead] sometime around Grails 0.2 saying "Do you realise what you've done!?! You have just changed the whole game of Java webapps!". Grails is no doubt going to be one of those disruptive technologies that forever changes how we build Java web apps going forward. The framework was awesome *then*, and a year and a half later we have something incredibly powerful.
Someone asked me the other day "But hasn't Grails just gone 1.0, isn't it immature?". I can only say that it's the most feature-filled 1.0 that I've ever seen! I shipped my first apps on 0.2 HEAD, and Grails could probably have gone 1.0 at the 0.3 stage. There was certainly pressure for that at the time, but the team was adamant that they would ship it when it was feature complete, and not be hassled into 1.0. It's a testament to their stickability that they kept to that vision. It was worth the wait.
Q. Do you have a preferred set of Grails plugins ?
A. If I was marooned on a desert island, what Grails plugins would I take with me?
RichUI would be in there for sure. The set of UI plugins in there are just very slick, and I'm a big believer that slick matters. People don't buy the steak, they buy the sizzle. All that.
I also love Searchable - that thing is just awesome. Those two are my favorite general purpose, meat-and-potatoes plugins. Both have great docs, and I've had good success with both getting things out the door quickly.
In the "more niche" plugin space, the GoogleCharts plugin just rocks. I use that for Stats charting in Gravl. In the "next plugin I'm trying out" list, I really like the look of the DBUnit plugin, that's definitely on my list as I ramp up my testing kungfoo.
Q. What can you tell us about Gravl ?
A. Gravl is my attempt to write a small feature-complete blogging engine for Grails. I was using Pebble at the time (an excellent Java-based solution), but the Grails community was crying out for more sample apps to learn off. Gravl is a lightweight Pebble :-).
My goal was to have it under 1000 Lines of Code - small enough that a beginning Grails developer could digest what was going on. It came in about 100% bigger than that, but remains a good sample of the common features of Grails that people want to do - and it's still pretty cool what you can do in 2000LOC. I think it took about 6 weeks to put together, and there's a lot of cool stuff going on in there (including WebFlow, Ajax, Customer Filters, Feeds, Search, and even some test cases!)
Q. What were the most challenging features to implement on groovyblogs.org and Gravl?
A. The Thumbnails feature of GroovyBlogs was a really bugger to implement. There's not many documented ways to do that sort of thing on the web, so I had to sort of find my own way there. I really wanted to find a cross-platform way of doing it, rather than shelling out to some third-party program. I eventually managed to get an SWT Browser component to do the capture for me, so it's almost cross platform (just the SWT libs for your platform and you're in business).
Q. What would you like to see in a future version of Grails ?
A. I think the whole plugin space is still evolving and has lots of cool things ahead. Dependency resolution around plugins would be nice. It would be nice to be able to declare that my project "depends" on RichUI, and not have to checkin RichUI code into my plugins folder - just let Grails download it and install it. Would make distributing projects a little easier.
I think that unit testing support is still in the early days. I've just finished a series discussing unit testing on my blog, and the framework support for it is still a little scratchy. I know the guys are working on stuff there (including integrated CI servers), and there's JIRAs in about mocking support, so that will no doubt be there soon.
It's hard to think of anything else. The Grails project velocity is so high, the quickest way to get stuff done is to just a raise a JIRA. Everything I've asked for has always turned up in a dot release with a month or two!
One thing I would like to see is more Groovy/Grails "community" sites built using Grails. The Ruby and Rails guys have really done great work building community sites, and I think it's the next logical step for us in growing the platform. Get busy people!
Q. What would you like to see in a future version of Groovy ?
A. Anonymous Inner classes! Particularly when interacting with Java libraries I find the lack of Inner classes frustrating. There's always workarounds, but it would be nice to able to do it as I do it in Java - much easier on the mental model.
I'd also like to see parentheses optional when invoking methods with no arguments. It would make writing DSLs a lot more expressive if we could totally get rid of those pesky parentheses. Again there are workarounds, but having this "just work" would be very cool (it's probably a ton of grammar work, but it would still be nice :-)
Q. Do you have some tips for people starting with Grails ?
A. The absolute best way to learn Grails is on the job. Download the distro, do the quickstart from the manual, and start on that pet project you've been putting off for years. Let you Groovy and Grails kungfu increase while you're working on a real project, rather than trying to learn a thousand things before you start. It's so addictive you'll be motivated to learn more as your project powers on.
Once you're underway and ready to learn more about Groovy, grab a copy of Groovy In Action to really understand some of the finer points of Groovy. It will also help you get more idiomatic in your Groovy approach to things. On the Grails side, grab a copy of Graeme's Definitive Guide to Grails (the 2nd edition is due mid year, and will be worth the wait). It's a great book for learning Grails.
Q. What does it mean to be a stunt programmer ?
A. LOL. Yeah, that's my title on my business card. These days there is a lot of talk about "Rock Star" programmers, which seems to me to paint a picture of celebrity and hubris. That model has never really fit with some of the great programmers I've hung out with in my career who will never make such a list, but have had a major impact on me professionally. Being a Rock Star is also not a very Australian thing.
Stuntmen, conversely, do the hard parts of movies, and really add spark to the action, but you'll never know their name: they make others look good. I picked up the term "Stunt Programmer" from my C days when I was hacking on Netscape Server plugins and one of the Netscape dudes used to use it as a tag in their code. The analogy really made sense to me, and I reckon that it sounds like a more Australian approach to the whole business of contributing to the software ecosystem.
Do the tough stuff, make a difference, feed your family, and make it home alive! Bring on the Groovy stunt programmers!
Glen is an Enterprise Java consultant who spends most of his days writing frameworks and highly available middle tier components for the Australian government, while also running a small recruitment company, so if you're looking for work in Australia...
Glen has been developing in Grails since 0.1 and launched his first public Grails site (an SMS gateway) on 0.2. He blogs frequently on Groovy and Grails related matters, releases tons of sample source and is the face behind the groovyblogs.org site.
Glen's other projects include opencsv, PasswordSafeSWT, and Gravl - the grails-powered blog engine that runs his blog.