6 ms·
> A simple ID like 3c6n63N is more than enough to represent any product while keeping it readable and making communication easier. A UUID alternative like a73ba
by emodendroket 3y ago
> A simple ID like 3c6n63N is more than enough to represent any product while keeping it readable and making communication easier. A UUID alternative like a73ba12d-1d8b-2516-3aee-4b15e563a835 is just wasteful from a user’s perspective.
I would challenge the premise we appear to be starting from, that the average end user cares to be dealing with any random string of numbers and digits. GUIDs work well, they’re implemented everywhere, and you won’t find out long after you go into production you made some mistake that is going to make it so you have to migrate away from them.
- czechdeveloper 3y agoPlus I could easily represent UUID in base64, such as JlEt5BSYe0enwB7nxl5V6g, which makes it shorter if I need that.
- masklinn 3y agoMaybe use a smaller alphabet though, base64’s can be quite hard to read / spell out / reproduce as it includes confusing pairs. While somewhat less dense, base58 or rfc 4648 base32 mitigate these issues.
- Olreich 3y agoAnd for UUIDs, Base58 and Base64 both require 22 characters, so no density loss! Even Base32 only takes you up to 26 characters.
- ianburrell 3y agoBase32 or Base36 have the advantage of using single case which is easier to read out. And no symbols.
- stevesimmons 3y agoThe official Base32 doesn't work for encoding UUID7, which is time-ordered, because its symbols for 0-31 are not in ascending ASCII order. My own preferred format for UUID7 is one I call "id25". It's really Base35 because alphabets of 35 and 36 characters both need 25 characters to represent the 128 bits in a UUID. So I can start with Base36 and take out one of the next most ambiguous character pairs. The result looks something like '0pydgw5pifvapk5zyhmpso5tx'. The two other advantages of using this id25 format rather than UUID7 are: - The id25 format is quite distinct from UUID4. So if you have UUID7s being generated distributedly (rather than centrally) and the UUID7 time-ordering feature is important, it's nice to have a format that a trivial "if '-' in uuid_string..." check will spot. - Because there are no hyphens or symbols, the whole id25 uuid can be selected in web page with a double click. Whereas a uuid will need a mouse movement to get all 5 parts.
- kiitos 3y agoCrockford base32 works, doesn't it?
- sokoloff 3y agoDo many use cases need lexical ordering for the encoding of the UUID? (The UUIDs themself would still be ordered; it's just the human/URL/wire encoding that isn't.) Most of the use cases I can think of where I'd want an ordered UUID, I probably wouldn't need to lexically compare the encoding of multiple such IDs (where I can see plenty of utility in the ability to compare the underlying IDs).
- Izkata 3y agoI've always seen the human encoding as the main point, so you can infer things about them while working with them. A database, for example, would have a datetime column that can be used instead most of the time.
- kiitos 3y agoFor sure yes! There are tons of situations where you need to use the string form of an ID, e.g. filenames, and you definitely want the lexical ordering of files in a directory to be correct.
- remram 3y agoSome alphabets have the disadvantage of generating swears, which might be a problem for your use. Applying filters is a difficult approach. Hex has the advantage there.
- happymellon 3y ago> You can't find the product sir? Try typing into the search bar DEADBEEF
- remram 3y agoIf you think of the worse ID you can spell with the full alphabet next, please don't write it here :)
- 38 3y agoor ascii85: -;cAU'UX5;VnaA:`a2[1
- afgrant 3y agoThe hazard of base64 is the use of '+', '/', and '=' characters, which most HTTP engines treat as special.
- drcongo 3y agoI read the article, scratched my head, pondered, came here to see if anyone else was confused, and I'm glad I did.
- 10000truths 3y agoI think a better argument is that that the identifier needs to be unambiguous in cases where e.g. an ID needs to be communicated over the phone between an end user and a customer service rep. But that is easily solved with encodings like Base58 that exclude ambiguous characters.
- SoftTalker 3y agoOnce you get over about 10 characters the chance that the user will skip or repeat a character or misread one goes up. Sometimes when I order parts for my car the site wants the VIN to verify that the parts are correct for that vehicle. I often have to make two or three attempts at entering it to get it right.
- beagle3 3y agoEventually, everyone converges to babble[0], BIP-39[1], mnemonic[2], diceware, pgp-word list or equivalent. [0] https://bohwaz.net/archives/web/Bubble_Babble.html https://bohwaz.net/archives/web/Bubble_Babble.html [1] https://iancoleman.io/bip39/ https://iancoleman.io/bip39/ [2] https://web.archive.org/web/20090918202746/http://tothink.com/mnemonic/wordlist.html https://web.archive.org/web/20090918202746/http://tothink.co...
- happymellon 3y agoI don't know of anyone who has converged on that. Although after reading that Babble link it sounds like a great idea for product id's. Scenarios where it is unlikely for people to have to read it out but when they do it's easy enough to convey. I regret that there are scenarios that we should have converged on it but didn't.
- tttp 3y agoyou might want to consider an alternative with a base32 encoding with a luhn checksum https://github.com/tttp/dxid https://github.com/tttp/dxid
- deleted 3y ago[deleted]
- Supermancho 3y ago> that the average end user cares to be dealing with any random string of numbers and digits. A developer, which I took to be "the user" for the purposes of this writeup, cares. My small concern is that the rand is insufficient to generate a unique enough string (just use a lib like snowflake to get overkill entropy), but I'm sick of having the format at all for inconsequential ids (eg https://www.uuidgenerator.net/ https://www.uuidgenerator.net/).
- sophiabits 3y agoAlso as a developer I really dislike UUIDs because the hyphens make it impossible to double-click copy. It’s a small gripe, but I need to copy IDs multiple times per day and it adds up. Other ID formats like cuid or KSUID don’t have hyphens in their canonical representation, and it makes them far more pleasant to work with
- henvic 3y agoYes! This might seem silly, but if you're working with a lot of data, it can be a pain and time drain...
- emodendroket 3y agoIf that’s your issue passing the formatting option to your GUID library to get the dash-free solution seems like it would resolve it.
- semi 3y agoThats typically something you can configure in your terminals settings. Though avoiding requiring everyone know how to do this and actually do this is an improvement in developer experience so there's some merit here.. but is there any real standards around what characters get included in copying like this, or any best practices based on common defaults? if not it might just become a situation of optimizing for your own workflow. and considering how ubiquitous uuids are and how common dash delimiters are outside of that(jira ticketscome to mind) maybe it would be better to fix places where double click selections do not include dashes instead of trying to avoid dashes in identifiers?
- MR4D 3y agoI like your thinking, but somehow fear that at some point in time in the future I'll get an ID like "S5o0QlI1" and my brain will automatically eject itself from my skull in disgust.