Live data from Hacker News

You Don't Need UUID

henvic.dev

31–40 of 199 posts

Re: You Don't Need UUID

#31
post #25

I recently found ULID. I like its simplicity. It is sequential. It has a very low probability of collision. And it is of a more reasonable length. Because it encodes the time, theoretically you could use it to grab the CreatedDate of a record without a need for another field. https://github.com/ulid/spec

Sequential isn't always simple. If your system is distributed in the slightest way (even just multiple threads), it's a bit of a luxury to find sequential guarantees.

Re: You Don't Need UUID

#32
post #9
post #2

When it comes to random identifiers, the advantage of uuid4 is mainly that it's a standard thing that everyone understands well, and finding a lib that generates one securely won't require any thought. It's never the ideal solution, but it's often good enough.

Agreed - not to mention the specification of new ones with different features keeps evolving.

Yeah I'm not a fan of the non-random UUID specs causing confusion. Seems like they mostly get used accidentally by someone who actually needed uuid4. "uuid5 is newer and better, right?"

Re: You Don't Need UUID

#33
A UUID is 128 bits, or 16 bytes. This code suggests IDs which are 11 bytes. That's not really comparable.

A UUID can also be encoded in any form, it doesn't need to be represented as the dashed string notation which is common, you can just as easily use the base58 alphabet suggested in the post.

But the code in the post doesn't encode to base58 correctly. You need to map 58 bits of the input, sequentially, to one character in the alphabet as output. You can't just mod each byte of the input by the alphabet length and use the corresponding alphabet element.

Re: You Don't Need UUID

#36
post #3

The crux of this argument seems to be that UUIDs are too long? Which I disagree with. I can't memorize them, no, and it would be cumbersome to try to say one aloud, but these aren't situations I've ever found myself in. Does it make the URL in the URL bar longer? Yeah, but does that matter?

> Does it make the URL in the URL bar longer? Yeah, but does that matter? Yes. That's one of the author's arguments. ) 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 an user’s perspective.

Must be oral communication, otherwise copy and paste the link.

And I bet that for most users 3c6n63N is as confusing as a73ba12d-1d8b-2516-3aee-4b15e563a835

Re: You Don't Need UUID

#37

Earlier quoted context omitted.

It matters aesthetically. A huge site like Amazon might care about that, otherwise it's not a high priority.

It somewhat matters aesthetically, but mostly people are going to ignore long random strings. UUIDs are at least visually kind of white noise, companies have no problem+with+links?that=look&like=this, so why do they care about UUIDs?

Some of us will strip off the crud to get the base URL, to avoid being tracked.

Re: You Don't Need UUID

#38

> 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 implem…

I 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.

Re: You Don't Need UUID

#39
> Version 4 is completely randomly generated (hence, it has more entropy) and is what most web systems seem to use. It has 16^32 = 2^128 bits that guarantee uniqueness and has an insignificant risk of collision.

Small correction here but it is not 128 random bits entirely: 6 bits are reserved for the version marker.

Re: You Don't Need UUID

#40
UUIDs are great for when you have a distributed system where connectivity between the nodes is intermittent, and every node needs to be able to create new entities without ever having ID collisions.

For instance, UUIDs allow mobile apps to create entities while offline.

Post reply on HN