Friday, February 8, 2008

astringency

On Wednesday I posted a little memo to all of my readers who may be hockey fans; it was only two sentences long, but it ended up causing much more grief than anything else I've written for this blog. I'm using this post as a budget therapy session.

First, I should clarify that this grief was completely internal and has nothing to do with the fact that the Hurricanes' best penalty killer is out for the season with a broken leg; in fact, I wrote the post in less than two minutes, and there is no evidence to suggest that any of my readers even read it, let alone cares about its topic. My pain is relate to Blogger's user interface, which I don't use for composing but do use for posting. After copying the text of my memo from a local file to Blogger's glorified <textarea/>, I accidentally hit some combination of keys that caused Blogger to initiate the publishing process and then go back two pages to the "dashboard"; it was all very fast, and not realizing what had happened, I started again by clicking the Create New Post button and re-copying my text.

Once I published, I realized that I had actually created two posts. The first had a permanent URL of /2008/02/rosey.htm and the second was at /2008/02/rosey-06.htm. This enraged me for reasons that I will get to shortly. My initial reaction was to delete both posts, republish my index page, and then create the post a third time. Upon doing this, my post resided at /2008/02/rosey_6595.htm. The exact role of these random numerical suffixes is unknown to people outside of the Blogger team, but I have a hunch: I think this is a case of REST pedantry.

Blogger is treating each new post as a completely new resource and it is ensuring that all new resources have a unique URI; because the tool uses the post title as the last token in the URI, it is tacking on a suffix so that the final URI does not conflict with any other resource. It does this even if the conflict is with a resource that no longer exists so that a client is never tricked into thinking it's dealing with the original resource (i.e., it does not realize the original resource was deleted).

This kind of behavior is similar to what you see in WS-* Land, where resources are identified using an endpoint reference (EPR). Once a WS-resource is destroyed (either implicitly or explicitly via WS-ResourceLifetime), its EPR is invalid forever. This is a pretty harsh requirement, but most implementations are able to satisfy it with the help of UUIDs. Blogger doesn't do anything so obtuse when constructing URIs for blog posts, but the suffixes make me think that there's some kind of logic in the Blogger engine that prevents two posts from ever having equal identifiers, even if their lifetimes do not overlap.

As someone who has had to implement universally unique identifiers with REST and WS-*, I can appreciate the motivation behind them; however, in the case of my blog, which is my own little sanctuary on the Internet, I would prefer to have more control over my URI space, even if it means I am not in 100% compliance with AtomPub or the majority opinion on rest-discuss. Let's face it, I'm doing this more for me than for you; if you want to read overly-zealous opinions about data formats and U.S. laws, there are eleventy scrillion other blogs that can fulfill your needs, but I only have one web site, and the fact that my URI space is completely organized except for one post is going to drive me absolutely insane.

/2008/02/rosey_6596.htm? What is that? It's just so... random. And un-RESTful. It might as well be an EPR.
<EndpointReference 
xmlns="http://www.w3.org/2005/08/addressing">
<Address>
http://codeunleashed.com/2008/02/rosey.htm
</Address>
<ReferenceProperties>
<ResourceId>6595</ResourceId>
</ReferenceProperties>
</EndpointReference>
At first I thought about changing the URI manually, but the index is stored in Blogger's database, so it will just revert back the next time I publish a post. I also considered deleting the post and keeping my feelings about the Hurricanes to myself, but I decided that writing seven paragraphs about five URI characters would be slightly less insane. It's part of my 2008 New Year's resolution to not waste time on small details that don't have an actual impact on future events. As you can see, it's going pretty well.

Labels:

0 Comments:

Post a Comment

<< Home