How to generate human readable IDs?


All of us have been given a record number or an ID of some sort for further reference. For example, the payment receipt, or a reservation number.

It is great to have a way to uniquely identify something, but don’t you hate spelling those numbers over the phone or writing meaningless numbers on paper stickers?

What if the IDs where not so boring? Actually, they don’t have to. Feeling tired of this disconnection between databases and humanity, I suggest to translate unique ids, uniquely to funny interesting, (well yet meaningless) sentences.

I have created a shell script on my mac that generates 16, 24, 32, 40, 48, and 64 bit unique IDs.

Please note that there is no need to store these IDs as long strings in databse, basically every number can easily be translated to a sentence with a discrete and simple mapping:

Assume we have 2 maps of “adj” for Adjectives, and “non” for Nouns. Use the following rule to generate the human readable IDs.

For example a 32 bit ID: adj  non “with” adj non

In above every adj, or non translates to 8 bit. We just need to keep two list of 256 words. One for adj and one for non.

Below is some examples for generating random IDs:

16 bit: steady aunt
24 bit: steady but huge aunt
32 bit: steady aunt with huge sofa
40 bit: steady aunt with huge sofa, said bomb
48 bit: steady aunt with huge sofa, said shiny bomb
64 bit: steady aunt with huge sofa, said shiny bomb to small bee

16 bit: yummy leg
24 bit: yummy but fierce leg
32 bit: yummy leg with fierce look
40 bit: yummy leg with fierce look, said rose
48 bit: yummy leg with fierce look, said shape rose
64 bit: yummy leg with fierce look, said shape rose to shaky rod

16 bit: broken feet
24 bit: broken but helpful feet
32 bit: broken feet with helpful stew
40 bit: broken feet with helpful stew, said eyes
48 bit: broken feet with helpful stew, said silky eyes
64 bit: broken feet with helpful stew, said silky eyes to cruel bomb

16 bit: open mom
24 bit: open but breezy mom
32 bit: open mom with breezy war
40 bit: open mom with breezy war, said fuel
48 bit: open mom with breezy war, said rich fuel
64 bit: open mom with breezy war, said rich fuel to wet map

16 bit: rainy trip
24 bit: rainy but sticky trip
32 bit: rainy trip with sticky ball
40 bit: rainy trip with sticky ball, said fly
48 bit: rainy trip with sticky ball, said dirty fly
64 bit: rainy trip with sticky ball, said dirty fly to strange pump

I much rather record one of above sentences as an ID. They feel like Haiku 🙂

Further improvement

Above codes would only be useful if the complexity of spelling words is not going to be a problem. Following techniques should be used if the Haikus are going to production:

1 –  The adj and nouns should be short an simple. We only need 256 of each so, it can even be done manually. Just get the list of adjs from primary school English books.
2 – There should be no spelling confusion. There are way more than 256 adjectives and nouns in English, so we will only select the words that do not sound similar. The old as wheel, Soundex algorithm could do a good job here.
3 – The lookup should not be literal. When someone enters an ID in the system, the experience should be enriched with word suggestion. Also the matching for words better be Fuzzy, e.g. translate the words to numbers based on both Soundex and edit distance.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: