A Flickr tag can create a data service. Photo: yoppy/Flickr
A friend who runs a market survey business recently asked for some advice. For an upcoming survey he needs to augment a questionnaire with a programmable image gallery. He’s dabbled in web programming, and reckoned he could figure out how to build a database-backed web app to solve this problem. But it’s been a while since he tried anything like that, and he wondered how all the cloud developments he’s been hearing about lately might alter the equation.
I think he was expecting me to review the tradeoffs between the conventional infrastructure hosting he’s familiar with and the new breed of cloud-based infrastructure. Instead I recommended an approach that has nothing to do with that choice, and everything to do with thinking like the web.
Suppose you have a set of images that depict assorted tables, chairs, and sofas in various colors. You want to be able to serve up views of all the tables, or just the black tables, or green chairs, or red sofas. Many web developers, given this problem, will proceed as follows:
- First, define a database table with columns for furniture type and color.
- Then create the interface you’ll use to populate that table with images.
- Finally build an app that queries the table and serves up sets of images.
Here’s a different approach:
- Go to Flickr.
- Upload your images.
- Tag the black tables with black and table, the green chairs with green and chair, and so on.
Now you’ve accomplished steps 1 and 2 without needing to create a database, host it somewhere, and build an interface to it. Two insights make this possible. First, when you use cloud services like Flickr or YouTube or Delicious you are not just sharing stuff, you are managing collections of web resources. Second, by naming those resources in a useful way you are defining APIs for accessing the resources. Here one such API for Flickr:
Swap in your FLICKR_ID and this query produces an RSS feed for your photos, selecting just those matching the given tags. Now all that’s left is step 3: build an app that performs the query and displays the results. For that, I suggested that my friend use a jQuery plugin. There are probably dozens that can do the job, here’s one I’ve tried that seems to work well.
When your digital stuff lived mainly on your own hard disk, useful naming was a best practice for personal information management. As the stuff migrates to the cloud that remains true. But the personal cloud isn’t just a remote hard disk. The things you put there can participate in an open ecosystem of data services. The quality of service you can provide to the ecosystem is a function of your ability to create, and usefully name, collections of web resources.