An alternative to a numeric identifier (?contactId=332) is a character-based value (?contact=walkerca). The character-based values render nicely on a URL and are convenient working with a database, often eliminating the need for an extra join to produce a meaningful query.
A few guidelines for a character-based value
- Limit the string length. 5 or 6 characters will contain sufficient ids, but may require a step to deconflict ids.
- Restrict characters. No spaces or special characters that would need to be encoded (and decoded)
- Encode a handling type. Preprend an additional character if processing is made easier.
- Accept all cases but standardize on one.
For a company like 'Kensington Inns, Inc.', an example algorithm would turn this into KENSIG or HKENSI where the 'H' standards for 'Hotel'.
While numeric identifiers are used throughout relational databases, a well-placed, character-based identifier can make processing easier, URLs simpler, and save an extra join on database queries. A character-based identifier helps troubleshooting, obviating the need to correlate the data to decode an unfamiliar integer.
This post is replicated from http://my.opera.com/walkerca/blog/2010/12/06/creating-identifiers-on-the-fly.