I got Potterred

Here I am, minding my own business, digging into Struts 2.0, when an owl from delivered a package on my doorstep on Saturday.

There was a book inside.

To be honest, it wasn’t completely unexpected. I stopped reading the Harry Potter series after book 5, because I really didn’t like the extended scenes of cruelty and nastiness, not to mention the fact that it took over 500 pages before Harry started to fight back successfully. Still, Ginger read book 6 and we pre-ordered book 7 when it first became available.

The release of book 7 coincided with the release of the fifth movie. I was reluctant to go see it, for the same reasons, but I figured I’d give it a try. Besides, Xander was away at camp and Ginger really wanted to go.

I really liked the movie. They downplayed the torture aspects (almost too much, may Dolores Umbridge rot in hell for all eternity — yes, I know it’s fiction, but nevertheless) and did a great job on the rest of the action and character development. That meant I had to dig into book 6, knowing that book 7 was coming on Saturday.

Book 6 was really good. I finished it Saturday afternoon and started book 7 that evening, resigned to the fact that nothing productive was going to happen in my life until that book was finished.

I finally finished last night. All I can say is, wow. That was fun, and amazing, and all that. I have no idea how they’ll make a movie out of it; it felt like there was material for at least three of them.

That lead me to the Wikipedia pages on the book, which were already quite complete and answered a few questions I had about horcruxes, hallows, and certain character biographies. Be sure to avoid the whole section until you’ve read the book.

I know this is a rather odd blog posting for my company site, but if anyone has tried to reach me and found me unavailable for the last few days, well, now you know.

As long as I’m off-topic, a couple of quick asides:

1. What I wouldn’t give for portkeys, or the floo network, or frankly anything to help me avoid the airlines, which are clearly in the service of the Dark Lord.

2. MyEclipse 6.0 should be out any day now. I’m really looking forward to it. I’ve been using the M1 release for almost a month, but I don’t want to get too heavily invested in it before the GA release comes out.

3. Now that the Yankees are in the midst of about 1000 games against bad teams, it’s a good thing the Red Sox picked now to go on a five-game winning streak. And who knew that Julio Lugo was a hitting machine? I hope that lasts a bit longer.

4. Xander is clearly having more fun this summer than I did at age 15. He spent a week and a half with my parents, then a couple days at home, followed by a week at camp as a counselor, a week with a friend’s family at their vacation house in Rhode Island, then overnight with friends last weekend, a party on Sunday, a sleep-over last night, and he’s got another week in camp next week. Not to mention that his end of semester grades were good enough (barely) to keep his new guitar. Yeah, he’s really got it tough.

5. Soon I’ll have to write a post about my new part-time job scoring minor league baseball games for Baseball Info Solutions. I’ve got a CT Defenders game tonight and tomorrow, though, so that will have to wait.

Grails Groovy

Moving from Groovy to Grails

When I first heard about Ruby on Rails late in 2005, I got very excited about it and was eager to learn more. Over the Xmas/New-Years break I purchased both the so-called “pick-axe” book (Programming Ruby, by Dave Thomas) and the Agile Web Developer’s Guide to Rails (by Dave Thomas and David Heinemeier Hansson).

I tried plowing through the Rails book, but while the text is clear and well-written, I quickly realized that in order to make any real progress I needed to learn as much Ruby as I could. Learning both at the same time was just too much. I therefore went back to Ruby, and after making progress on that, I eventually dug into Rails again. Since my primary skills are Java, J2EE, and XML related, I couldn’t spend full time on those topics, but slowly made progress over the first few months of 2006.

Eventually, I abandoned that effort. I’ve talked about it here in earlier posts, but the short answer is that I came to believe the Ruby (and Rails, even more so) is really just a niche product. While both are very interesting and helped me learn a ton of new concepts (Ruby especially helped my JavaScript when I got to Ajax), I don’t believe that the industry is ready to abandon its considerable investment in Java technologies so it can start rewriting everything in Ruby. Add to that the fact that Rails is great if you’re starting from scratch but very annoying if you’re not (especially if you’re stuck with a legacy database that violates Rails conventions and even uses — horror of horrors — compound primary keys), and it just didn’t seem worth the effort.

I also became rather disenchanted with the arrogance and even haughtiness of the Rails team, from DHH on down. I liked that they violated accepted conventional wisdom and made it work, but I got really tired of the superior attitude and unwillingness to acknowledge that not everyone has the freedom or interest in doing everything their way. In the end, I decided that (1) Ruby is totally cool and can do almost anything (see Enterprise Integration with Ruby and Ruby Cookbook), and (2) Rails has a lot of great ideas, but neither was really my future.

In the fall of 2006, I then had the great opportunity of attending a talk by Jason Rudolph, who is a committer on the Grails project. Grails, as it sounds, is a framework rather analogous to Rails, based on the Groovy language. The cool part, though, is that Groovy code compiles directly to the JDK, so it cleanly interoperates with existing Java classes. Grails itself uses Groovy in many places, but really gets its power by leveraging existing, well-established Java projects like Spring and Hibernate.

In other words, Groovy and Grails are perfect for me. I’ve therefore been trying to absorb them off-and-on for the past six months or so. It’s hard to dedicate contiguous blocks of time to them, but I keep plugging away at them. From my Ruby experience, I decided that the real key was to learn Groovy before trying to absorb Grails. Therefore, I purchased Groovy in Action (by Dierk Koenig and others) and The Definitive Guide to Grails (by Graeme Rocher), and also acquired Jason Rudolph’s book Getting Started with Grails. That latter book has gotten dated very quickly, but is still a lot of fun.

I’ve mentioned it here many times, but Groovy is seriously cool. In fact, pretty much every Java developer I’ve shown it to gets excited about it. Even silly, trivial things are great.

For example, to make a Java POJO that will be an entity in a database somewhere, I have to write a class like:

public class Employee {

  private int id;
  private String name;
  private double salary;

  // ... other attributes as necessary ...

  public Employee() {}

  public Employee(int id, String name) { = id; = name;

  // ... other constructors as necessary ...

  public int getId() { return id; }

  public void setId(int id) { = id; }

  // ... all of the other getters and setters ...

  // ... overrides of equals(), hashCode(), and toString() ...


That’s a fair amount of code for what is essentially a trivial data structure. Even though Eclipse can generate much of that for me, it’s still rather tedious and verbose, especially when you compare it to the analogous Groovy bean:

class Employee {
  int id
  String name
  // ... other properties ...

That’s it. Not only don’t I need any semicolons (trivial, I know, but still kind of cool), but the attributes are assumed to be private, any required public getters and setters show up whenever I access or set a property, and any constructors I might need are already there, too. Truly sweet.

I can populate my Employee instance as easily as

Employee fred = new Employee() = 1 = "Fred Flintstone"
// ... etc ...

which uses the public setter methods even though it looks like I’m accessing private properties. Actually, there’s an easier way.

Employee fred = new Employee(id:1, name:"Fred Flintstone", ...)

where I’m using Groovy map properties to populate the attributes, even though I didn’t write a constructor at all.

I can also do it this way:

def values = [id:1, name:"Fred Flintstone",...]
Employee fred = new Employee()
values.each {  key, value ->

which looks Ruby-like and is also pretty cool. That’s still too complicated, though. I can also do this:

def values = ... // as above
Employee fred = new Employee() = values

That’s better, but I can even do:

def values = ... // as above
Employee fred = new Employee(values)

using the map directly. The best part is that I can even write the Employee class in Java and populate in a Groovy script much the same way. How cool is that?

Groovy therefore simplifies Java dramatically. Its dynamic typing makes coding much simpler, too. Groovy is attractive for its Java simplifications, but once you dig into it, its closure support is exciting, but builders are simply incredible. There’s nothing better than being able to build an XML document by writing

def  builder = new groovy.xml.MarkupBuilder
builder.employee ( {
  // ... other instance variables ...

which automatically creates an XML file with all the tags, attributes, and text values automagically inserted. That’s unbelievably sweet.

On my current trip down here to Atlanta, though, I decided I’d finally read enough Groovy, even though I’m far from good at it. It was time to start digging into Grails again.

Grails is still evolving quickly, so every book I have is effectively out of date. Still, what I’ve seen is fantastic. I can’t wait to learn more, and, even better, start building some real sites with it. I’m also eagerly awaiting the Grails 1.0 release, tentatively scheduled for October.

I’d write more about it, but this post has already gone on way too long. Still, the more I learn the more enjoyable the whole thing is. It’s been a while since I felt that way about a programming language.


Burned by MLB and DRM

I know this isn’t really business related, but I thought I’d write a post about this problem just in case anybody knows a solution.

In late 2004, after the Red Sox won the World Series, I purchased the downloadable broadcasts of all of their playoff games from Major League Baseball. That came to about 20 gigs of downloads covering 14 games, each of which was playable in Windows Media Player only (the only supported player at the time).

In each case, the first time I tried to play the file on a new computer, the program contacts MLB for a license file, which is then stored locally. After that I can play the files without a problem.

Well, I’m not really an “early adopter,” but that is almost three years ago and I’ve gotten new systems since then. The field of digital downloads has also, shall we say, moved on. Anyway, the other day I tried to play one of those files on my current computer, only to discover that the license download site no longer exists.

I contacted MLB about this at their 800 number. I eventually had to talk to a manager in order to find somebody who understood the situation.

He informed me that their digital download service is down and therefore unavailable. I explained that the files had already been downloaded years ago and I only needed the licenses, which I’d bought and paid for long ago.

That didn’t matter. I still need to contact the digital download service, which is not available. Worse, it’s been down all year, and, believe it or not, he had no idea when — or even if — it would ever be back up. He suggested I keep checking periodically, because he’s doing the same thing. And no, there is no one else I’m allowed to talk to about this.

The bottom line is that I now have a complete set of video files that I can’t play. I guess this is yet another example of the evils of digital rights management. Probably serves me right for going through legal channels to get them in the first place.

Any help would be greatly appreciated.