this post was submitted on 30 Jun 2024
119 points (98.4% liked)

Programming

16760 readers
108 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 1 year ago
MODERATORS
top 29 comments
sorted by: hot top controversial new old
[–] thanks_shakey_snake@lemmy.ca 57 points 1 month ago (2 children)

They should make the versions UUIDs instead of integers so that we don't make assumptions about their ordinal relationships.

[–] kibiz0r@midwest.social 4 points 1 month ago

Or maybe an abbreviated hash of the text of their specifications?

[–] RonSijm@programming.dev 3 points 1 month ago (1 children)

Yea, should have been V-00000000-0000-0000-0000-000000000008 instead

[–] darkghosthunter@lemmy.ml 2 points 1 month ago

Yes and no. They had to put the version identifier somewhere to avoid sorting problems or parsing problems, so I think that putting somewhat in the middle is a good tradeoff.

[–] breakingcups@lemmy.world 18 points 1 month ago (1 children)

A lot of people in this thread who don't fully understand how UUIDs work...

[–] atzanteol@sh.itjust.works 5 points 1 month ago

You're not kidding.

[–] abbadon420@lemm.ee 14 points 1 month ago

I didn't even know it was an ietf standard. Let aline there were versions. Apparently it's only since may this year that there are 8 versions. Before it were only 5.

[–] Zikeji@programming.dev 11 points 1 month ago (4 children)
[–] ChairmanMeow@programming.dev 10 points 1 month ago (2 children)

At the company I work at we use UUIDv7 but base63 encoded I believe. This gives you fairly short ids (16 chars iirc, it includes lowercase letters) that are also sortable.

[–] shotgun_crab@lemmy.world 1 points 1 month ago (1 children)

I'll be borrowing that little trick

[–] ChairmanMeow@programming.dev 1 points 1 month ago

https://github.com/TheArchitectDev/Architect.Identities

Here's the package one of our former developers created. It has some advantages and some drawbacks, but overall it's been quite a treat to work with!

[–] RonSijm@programming.dev 1 points 1 month ago (1 children)

base63? I'd guess you'd mean base64?

Anyways, doesn't that fuck with performance?

I'm using this in production: RT.Comb - That still generates GUIDs, but generates them sequential over time. Gives you both the benefits of sequential ids, and also the benefits of sequential keys. I haven't had any issues or collisions with that

[–] ChairmanMeow@programming.dev 2 points 1 month ago

It's Base62 actually, misremembered that. It's to avoid some special characters iirc. And no, performance is fine.

We're using this: https://github.com/TheArchitectDev/Architect.Identities

[–] bitfucker@programming.dev 2 points 1 month ago* (last edited 1 month ago)

I prefer CUID

Just to clarify: Yes, I do know not all use cases are appropriate for CUID. But in general when generating ID, I'd use CUID2

[–] Aux@lemmy.world 1 points 1 month ago

I vote for nanoid.