Friday, November 27, 2009

CouchDB attachments, mapping JSON to Java

Wasn't obvious to me how to map this in Java JSON libs, but the way that CouchDB stores references to a document's attachments corresponds to a Map:

"_attachments":{
"ALPHA.png":{
"stub":true,
"content_type":"CONTENT/TYPE",
"length":2351959,
"revpos":1
},
"CHARLIE.png":{
"stub":true,
"content_type":"CONTENT/TYPE",
"length":6376790,
"revpos":1
},
"BRAVO.png":{
"stub":true,
"content_type":"CONTENT/TYPE",
"length":2361940,
"revpos":1
}
}

E.g.:

Map attachments;

Monday, November 16, 2009

Web Framework Names of the Future

Following the trend with Ruby on Rails, Groovy on Grails, here are my predictions for web frameworks of the future (with a little help from a script, favs in bold):

  • Boobies on Bails
  • Brewski on Brails
  • Doobie on Dales
  • Droopy on Drails
  • Fruity on Frails
  • Goudy on Gails (great font support)
  • Hippie on Hails
  • Judy on Jails (isn't that a show?)
  • Loopy on Lails
  • Moody on Males
  • n00b on Nails
  • Poopy on Pails
  • Scooby on Scales
  • Slurpie on Slails
  • Snoopy on Snails
  • Soupy on Sales :-)
  • Spooky on Spails
  • Troopy on Trails
  • Voodoo on Veils (how cool is that?)
  • Wookie on Whales
  • Zippy on Zales


Saturday, November 14, 2009

Notes on Scala and Groovy

I love Scala's:
  • concurrency/actor support
  • combined Class definition with primary constructor
  • operators == methods
  • sensible typing

I dislike:
  • Collections are not 1:1 compatible with Java Collections
  • Terse syntax still feels awkward to a 10 year Java veteran

I love Groovy's:
    • Close but improved Java-like syntax
    • Closures
    • Builder libs

    I dislike:
    • Hard to remember when parenthesis are optional.
    • Lack of anonymous classes (such a pain for libs like Wicket)


    Maybe call it.... Scooby? ;-)

    Spring RestTemplate, PUT, DELETE

    Spring's RestTemplate is nice, but I don't understand why it doesn't easily support extracting response objects for delete and put calls...
    E.g. CouchDB REST API uses this approach.

    Yeah there's the execute method, but then you need to reimplement the RestTemplate.PostPutCallback class, which is private..


    Friday, November 13, 2009

    Head Going to Explode

    Scala+Groovy+Java+Spring+CouchDB in same codebase - amazed this actual works.

    Scala is great, but makes me feel like a drooling idiot.
    Hence, the use of Groovy - which makes me feel oh so clever again.

    xoxo,
    zark