33rd Degree day 3 review

At the last day of the conference, I’ve decided to skip the first presentations, and get some sleep instead. I was afraid that Venkat’s show is going to be too basic, I will see Jacek Laskowski talking about closure at 4Developers, which I’m kind of s…
At the last day of the conference, I’ve decided to skip the first presentations, and get some sleep instead. I was afraid that Venkat’s show is going to be too basic, I will see Jacek Laskowski talking about closure at 4Developers, which I’m kind of supervising from the Java perspective. As an afterthought, I should have gone to see “Static Code Analysis and AST Transformations” by Hamlet D’Arcy, as I really like this guy and the topic is intriguing at least, but I didn’t want to intoxicate myself more with coffee, and really needed to get some sleep.

MongoDB: Scaling Web Application

The first talk I’ve seen was by Ken Sipe. It was a very interesting case study, and I love case studies. They give you a real perspective, unlike the product-half-marketing that some authors are doing, and unlike self-marketing that some “professional” speakers perform. 
Ken had an interesting project at hand: a Facebook like social service, that deals with politic, named GoVote. Half of the presentation was a bit basic, with simple CRUD syntax, but when Ken started to talk about modeling, it got interesting.
Ken used Grails as the web framework and went through several plugins/libs to get him to the performance and efficiency he needed. Every one of them failed, except for GSP, which is a thing worth reflecting about. His lesson was not really surprising: you should not use any abstracts (ORM?), when playing with document databases. He sticked to GORM because of how fast his problems were solved on the mailing list and bug tracker, but GORM doesn’t really give you the resolution you want, when dealing with tree structures composed of documents.
My favourite part, albeit short, was about modeling. Ken managed to get ONE hit to DB per dynamic web page, something I’ve always dreamed of. His advice was to focus on use cases, and design document model with use cases in mind. You get a sign of bad design, when you find nested joins (hitting more than once for the data), and you can usually get away with tags, instead. Interesting stuff, I hope to verify that soon.

HTML5 For Developers

Nathaniel Schutta had a large presentation at hand, nothing he kind fit into only one hour, so he gave us a choice: what do we want to hear about. It turned out, the audience was most interested into Web Workers, local web storage and Canvas. Each had their caveats. 
Web workers allow to get some much needed concurrency  into heavy GUI (or game engines, I guess), work with a simple API where you can handle errors and spawn new workers.
Local storage is unfortunately limited by default to 5MB, and you may get unsuccessful persuading the user to change it. Apart from that, it’s a simple key-value store (both Strings), with storage events (think on-insert etc.), but current implementations handle those not without some problems.
Canvas was quite interesting. Though it has a very simple API, and only basic primitives implemented, I’ve already bought a 500 pages long book about it (and that’s without any info on all the libs build on top of it).

Ending keynotes

There were three ending keynotes, one from Nathaniel Schutta, Jurgen Appelo and the last from Robert C. Martin. As expected, those were entertaining, though unless you’ve been sleeping through the last three years in a cave, you would not be surprised by both craftsman. Jurgen, however, was quite a different animal.
His talk, titled “How to Change the World”, was based on his book “Management 3.0” and his work afterwards. I’ve been interested in the mechanics of change, since I’ve been trying to change with more or less luck, all the companies I’ve worked for. Jurgen has a lot to say in that matter, and I’ve been wrong on so many levels in my attitude towards change, that the talk was very refreshing.
You can take a look at his presentation here:
Overall, while it’s too early to say whether that was the best JVM conference in Poland this year, I can recommend 33rd on all grounds. I feel I can bet blindly on it next year. Grzegorz Duda delivers enormous knowledge in so little time and so little money.
You May Also Like

Grails render as JSON catch

One of a reasons your controller doesn't render a proper response in JSON format might be wrong package name that you use. It is easy to overlook. Import are on top of a file, you look at your code and everything seems to be fine. Except response is still not in JSON format.

Consider this simple controller:

class RestJsonCatchController {
def grailsJson() {
render([first: 'foo', second: 5] as grails.converters.JSON)
}

def netSfJson() {
render([first: 'foo', second: 5] as net.sf.json.JSON)
}
}

And now, with finger crossed... We have a winner!

$ curl localhost:8080/example/restJsonCatch/grailsJson
{"first":"foo","second":5}
$ curl localhost:8080/example/restJsonCatch/netSfJson
{first=foo, second=5}

As you can see only grails.converters.JSON converts your response to JSON format. There is no such converter for net.sf.json.JSON, so Grails has no converter to apply and it renders Map normally.

Conclusion: always carefully look at your imports if you're working with JSON in Grails!

Edit: Burt suggested that this is a bug. I've submitted JIRA issue here: GRAILS-9622 render as class that is not a codec should throw exception