One of the small things that we’ve been adding to Typo recently is UUIDs for assorted bits of content. The only real consumer right now is the Atom 1.0 feed code, but they’re stored in the DB and sooner or later we’ll update the RSS feeds to use them too. Every item in a RSS or Atom feed is supposed to have a unique ID that is stable through time and across aggregators. Done properly, that means that readers will be able to recognize when they receive the same content via two different paths–like when you’re subscribed directly to a blog but also receive some of the same articles via *Planet-style aggregators or search feeds.
Unfortunately, Ruby doesn’t come with any code for generating UUIDs. When I started adding UUIDs to Typo, I found an old project on RubyForge that hasn’t been updated in 18 months, but it doesn’t work right on OS X and I didn’t really feel like fixing it. So I cheated and generated a MD5 from a combination of the object state and the clock and then shoved it into the DB. It’s not RFC 4122-compliant, but it works well enough in practice. Since our previous Atom feed code generated utterly non-unique
tag: IDs (there’s nothing wrong with
tag:, but we weren’t putting nearly enough data into it to actually generate unique IDs), even non-compliant MD5s were a big step in the right direction, and I figured that it’d be easy enough to plug a real UUID library in once once arrived.
It looks like I was right–Bob Aman sent me mail yesterday to tell me that he’s released a new UUID library for Ruby. I spent a couple minutes this morning ripping out my old UUID hack and replacing it with his RFC-compliant implementation, and once I finish running the last round of tests I’ll check it into the tree. Thanks, Bob.