Lots has now been written on schemas for storing tags (mostly in relational databases). In fact Tag Schema is a blog and mailing list devoted entirely to exploring that space further. (maintained by Nitin Borwankar, working at Odeo these days).

So what happens when we take off our DBA hat, and put back on our programmer hats? (because really, who has seperate DBAs these days?)

Most implementations I’ve seen treat tags as something you put in a bucket attached to an object. (could be most implementations I’ve seen are in Rails which encourages this)

But tags aren’t something an object has, their something an actor said about an object. An actor is key. Tags without someone/something behind them are devoid of context and meaningless. So rather then coding it as:

object.tags << sometags

consider

user.tags(object, sometags)

where tags is no longer a noun (a collection), but a verb.

At some point I don’t care how you store it in your database, but you need to be thinking about it as something a user is doing to the object.