Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> encode the IDs with base32/58/64 at the edge to make them shorter

Having tried this I immediately regretted it. Storage is not costly enough to justify the additional pain points that you've correctly identified.

> UUID would specify a more url-friendly standard representation

There's always the 2.25 OID space via URN (urn:oid:2.25.12345...). In which case you encode the underlying integer directly without any grouping punctuation involved.

For the same reason above you should use probably use a single encoding for all use cases, at which point, just using the ugly 8-4-4-4-12 will save you the most trouble.



Not sure why your comment was flagged. I also somewhat regret using base58 UUIDs, but with sufficient DB and app-side helpers, and sufficient discipline to always convert at the edges, it became tolerable. It was the only option I could come up with to retrofit short IDs onto a system designed with UUIDs where a project owner decided our URLs needed to be shorter and prettier late in the development process.


I don't think they're suggesting storing them in base32/58/64, but just having that be how they're presented to the user. We do this in some of our APIs- if the URL has an ID of a specific length we try to turn it into a full UUID first before passing it on to other code. In the postgres database, the ID column is still a UUID type.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: