A fun little thing

The Romney campaign’s web site is coded with a bit of an open loop. It makes sense from a dynamically generated website perspective I guess. However, it’s also the sort of thing that lazy RESTful programming gets you. The idea being that you have a template that is populated by values from a data store based on parsing the URL that lands you there. The lazy was of doing things is to just assume that every value passed is valid. The smart way of doing this is to check to see if you have something useful for that value and to redirect to some kind of error if not.

For example, the good way of doing this is this very blog. Let’s say you want to see every blog entry published in 2012. You’d use the address http://blackfez.com/2012. Let’s say you’re on to the trick and want to see every blog entry published in 1948. You’d type http://blackfez.com/1948. Notice how the second link redirects to an error page? This is smart. And relatively simple. You just check your input before going off to render stuff.

Enough of the theory, why is this fun? Because with lazy RESTful programming you can do stuff like this:

Anyway. It’s fun. At least to me. It’s also a bit of lazy programming and leaves the Romney campaign open to some needling. And it seems like the last thing the guy needs is another exposure to ridicule.