In my last blog, I suggested that if you wanted to learn Groovy or Grails, that Scott and Andrew at ThirstyHead were the people to talk to. Well, last week I put my money where my mouth was and attended the inaugural class from ThirstyHead, "Advanced Grails", taught by Scott in Lone Tree, CO.
With the exception of a hard drive crash on my part that resulted in switching laptops mid-class, everything went fantastic. I really learned a lot in three short days.
I have extensive experience working at many levels of software development, from writing assembly and embedded C on 8-bit processors, to developing hard real time systems using a commercial RTOS (in C & C++), to multi-threaded Java development. One co-worker recently called me the Swiss army knife of programmers. I really liked that description. But the compliment of tools in this knife is not complete by a long shot and I am always looking to add new ones. Web development is one item lacking from my repertoire. Enter Grails.
A web framework targeted for the JVM, most first reactions tend to be "Hmmm, yet another web framework". The distinction Grails brings to the picture is a framework that embraces convention over configuration, dynamic programming, built-in support for testing, and tools that fit well in an agile shop, all this in a framework that is inherently Java friendly. While there is no arguing with the fact that Grails and it underlying language, Groovy, borrowed a lot of inspiration from the Ruby on Rails framework, it is relevant in its own right due to its strong integration story with Java. For a beginning look at Grails, check out Scott’s Mastering Grails series on IBM DeveloperWorks. There are also some good books out there, Grails in Action and The Definitive Guide to Grails. After you are comfortable with the tutorials, you have the basics under your belt, and you want to move to the next level, Scott’s class should be a prime consideration.
The goal of the class was to do a deep dive into the inner workings of Grails. In Scott’s words, by the end of the class, he wanted us to not only know how to use Grails, but how to make it sing… to a tune of our own selection. I think he got the job done.
We started with a deep dive into skinning a Grails app. Step one was looking at some existing CSS templates that are available via Creative Commons. After choosing one, we learned how to skin our app with it, modify the stock GSP (Groovy Server Pages, similar to Java Server Pages). In true agile fashion (Scott is an expert on Agile development as well), we added a feature at a time, first adding the correct tags and labels to the GSP and then learning how to break it into reusable templates. The View aspect of the MVC pattern is one of the areas I am weak in, so this section was extremely helpful. I will be attending the AJAX spike offered by ThirstyHead in April to further expand my knowledge in this area.
The next section covered Authentication and Authorization in a Grails application. Scott demonstrated, in a remarkably small amount of code, how to roll your own basic A&A module using Grails interceptors. He followed this up by introducing two popular security plugins, Authentication and JSecurity. Authentication looks fairly straightforward and provides some bells and whistles that would require more effort to develop from scratch. JSecurity appeared to be the nuclear option for security, powerful, but complicated.
Scott spent considerable time covering how Grails supports ReSTful web service support, including time spent looking at other ReSTful web sites. In the special case of sites that only provide read access to their data, Scott has coined the term GETful (since the only HTTP verb supported is GET) to describe the interface. ReST is becoming extremely popular due to the ease with which it can be implemented without having to compromise application functionality. Grails makes a ReSTful app very easy to implement.
We then covered several miscellaneous topics, including codec development (allows data conversion services to translate data to and from strings), operator overloading (supplied via Groovy), file upload, supplying syndication services from a site using Atom, indexing using Lucene and Compass, and integrating support for e-mail and JMX monitoring into your application.
We finished up the last day by digging into the details of the Grails build system, which is based on Gant, the Groovy DSL that wraps Ant. In this section, we learned how to extend the build system to perform custom actions during a build (like packaging special files into the jar or war file).
This was a LOT of info to fit into three days. Surprisingly, at no time did I feel that Scott had to rush things and we even had time to take a couple of detours based on questions from the class. The most memorable was when we figured out how the Twitter ReST interface worked. There was ample time to work on the lab exercises, which were written to build upon and reinforce the lecture material. Scott was always available when things went horribly wrong. The labs really brought everything home.
Another cool take away from class was that Scott bundled up all of the code he wrote during his lectures. Most of this code is commented to help remind us what the key points were for that code. This code is going to be a great resource as I start to use the material I learned.
Given what I already knew about Scott, his knowledge of the subject matter, excellent speaking skills, and cool sense of humor, I can’t really say I’m surprised about how well the class went. I’m looking forward to attending the tech spike in April.
If you are in need of a quick jumpstart in any of the topics they offer, try ThirstyHead. You won’t regret it.