Live data from Hacker News

You Don't Need UUID

henvic.dev

41–50 of 199 posts

Re: You Don't Need UUID

#41
> This solution uses the human-readable base58 encoding scheme.

We could encode the 128 bit UUID integer in base58 as well if needed. Its textual representation won't conform to the standard but we'd get the same number of bits. Which would be 2^122 or 2^121 bits of uniqueness not 2^128 if it's a proper UUID.

11base58 character certainly doesn't have the 2^122 bits. So we could decided separately if we could either reduce the number of bits needed and/or use a different encoding.

> If you click and buy any of these from Amazon after visiting the links above, I might get a commission from their Affiliate program.

:-)

Re: You Don't Need UUID

#42
I’m not sure if this is accurate any longer, but it was bad practice to use UUID’s as PK’s in PostgreSQL for example due to indexing and performance. Is this still true? It’s really nice in PostgreSQL to just do:

    id UUID DEFAULT gen_random_uuid()

Re: You Don't Need UUID

#43
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?

Nowadays many links are much longer because of referrer information and tracking parameters. So the UUID doesn't add much.

Re: You Don't Need UUID

#44
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.

The point of a UUID is to have a unique machine ID that can be generated in parallel by separate, non-synchronized processes.

You don't need to make it a user exposed identifier, and you can have a centralized (but out-of-the-critical-path) process assigning friendly IDs if you can afford visibility delays (for either the whole item or at least the friendly ID, which if it is the only user-facing locator may mean that the individual item can’t be directly accessed even if it is visible in aggregates, until that is assigned; if you allow access by both the UUID and the friendly ID, with the latter presented as preferred once available, this is resolved but this may appear messier.)

Re: You Don't Need UUID

#45
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?

>Yeah, but does that matter?

I'm really reaching here, but an ID that omits special characters is easier to extract from a url, since it can be double-clicked in a URL bar to select it, whereas a GUID with hyphens forces the user to select the beginning and the end of the string.

Realistically I think this matters to developers more than users (I hope your application doesn't force users to interact with GUIDs in the address bar) but that's the only "waste" I can identify.

EDIT: Someone elsewhere noted that they can base64 encode their GUIDs to achieve this and I'm seething that I'd never thought to do that

Re: You Don't Need UUID

#46
> As Tom Scott shows in his video, 11 base58-encoded characters are enough for YouTube to serve content even when considering that private videos should be undiscoverable.

Nitpick: Google isn't concerned about the discoverability of private videos; those can only be viewed when granted access. You're thinking of unlisted videos.

Re: You Don't Need UUID

#47

There are so many nuances and edge cases not mentioned in the article. The author needs to do several projects in real life before making global pronouncements like this.

The lack of humbleness and respect for devs who have came before you and solved all these problems is coming through strong. But I myself was that way 15 years ago. It takes a lot of hard lessons to realize everything new is old and we truly stand on the shoulders of 7000 giants all standing on each others’ shoulders.

Re: You Don't Need UUID

#48
post #5

Sure, you don't need them, but why re-invent the wheel? At least UUIDs are not some one-off function in a helpers file that may need to be amended many times before you get it right, but are backed by a specification, are time-sortable, etc.

Not all UUIDs are time-sortable.

Re: You Don't Need UUID

#49

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?

apple.com/iphone

You can't beat that. Or would you rather receive texts that include the following?

    https://www.amazon.com/dp/B09V3HZ8B5/?pd_rd_w=DAycy&content-id=amzn1.sym.04e31e32-5e01-4048-8b59-a557891d595f:amzn1.sym.04e31e32-5e01-4048-8b59-a557891d595f&pf_rd_p=04e31e32-5e01-4048-8b59-a557891d595f&pf_rd_r=M1KXM468KNZJV189JBE7&pd_rd_wg=3O1uC&pd_rd_r=e51c1edc-213f-4c6d-b081-e23afa6bf4ab&ref_=vn_s_iwp&qid=1694453553

> companies have no problem+with+links?that=look&like=this

Let's not match the lowest common denominator, shall we?

Re: You Don't Need UUID

#50

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?

Cause some links are more likely to be shared, meaning they'll appear in a comment or SMS rather than just in your URL bar. Like if I copy a link from YouTube into HN: https://www.youtube.com/watch?v=00Uw9kgZ4QM

I'm sure they put some thought into not making it ?v=f6dde15a-3485-4f36-b0b9-a3b56fbc12ae.

Post reply on HN