My Month of New Technology

I'm David Eisinger, and I'm learning a new technology every day for a month.

Day 25: HTML5

Greetings from sunny Burbank. Today I spent some time with HTML5, the new specification for web markup. There’s a lot of stuff in HTML5, but I chose to focus specifically on offline storage. What local storage accessed via Javascript has to do with HTML … not sure. But I’m glad it’s here.

As part of HTML5 local storage, modern web browsers ship with a built-in relational database. Most of the information about this functionality seems to be from around 2007, and a lot of it is outdated, but I found a working example and was able to pick through its source code. I created a small todo list app — pretty crappy, but enough to get a feel for how it works. As a Rails guy, I don’t spend much time writing SQL, and when I do, it’s because a problem has gotten particularly interesting. Having to manage my own database connections and write the SQL commands to insert data felt like a step back to 2005. If I was to build an app this way, I’d definitely check for some kind of ORM — JazzRecord looks decent, but doesn’t support HTML5 at the moment.

Next, I took a look at local key-value storage. Apple’s WebKit docs were spot on, and it was dead simple to store and retrieve values in the browser console. I rewrote my todo app to use this alternate data store, which worked decently, though I was disappointed to find that arrays can be stored, but come back as strings. It’d be incredible if it worked more like Redis, letting you store more advanced data structures. I guess it’d be easy enough to store JSON, though I don’t know what the performance hit is for serializing and deserializing data on each request.