Remix.run Logo
jeffrallen 3 hours ago

Am I the only one who hates UUIDs and doesn't see the point of them?

Having any structure whatsoever in them is pointless and stupid. UUIDs should be 128 buts of crypto.Rand() and nothing else.

Argh.

sevg 2 hours ago | parent | next [-]

UUIDs are recognizable, have a version field, can be sorted in the case of UUIDv7, a standardized format means easy interoperability (eg, encoding, validation, serialization etc), and databases can optimize storage and efficiency when using a native UUID type.

If just using random bytes, you still need to make decisions about how to serialize, put it in a URL, logging etc so you’re basically just inventing you’re own format anyway for a problem that’s already solved.

masklinn 2 hours ago | parent [-]

That the problem is already solved does not mean the solution is good. Or that you can’t solve it better.

A uuidv4 is 15.25 bytes of payload encoded in 36 bytes (using standard serialisation), in a format which is not conducive to gui text selection.

You can encode 16 whole bytes in 26 bytes of easily selectable content by using a random source and encoding in base32, or 22 by using base58.

sevg an hour ago | parent [-]

You’re absolutely right! The first thing anyone says about uuids is: i need them to be easily selectable in gui

/s

whateveracct 2 hours ago | parent | prev | next [-]

I treat UUIDv4s as 128 random bits and it triggers ppl.

beart 2 hours ago | parent | prev | next [-]

UUIDs aren't random by design, and the structure is not pointless. Calling something you don't understand "stupid" is probably not a good approach to life.

One example where UUIDs are useful is usage as primary keys in databases. The constraints provide benefits, such as global uniqueness across distributed systems.

masklinn 2 hours ago | parent [-]

The global uniqueness of a uuid v4 is the global uniqueness of pulling 122 bits from a source of entropy. Structure has nothing to do with it, and pulling 128 bits from the same source is strictly (if not massively) superior at that.

fragmede 2 hours ago | parent | prev | next [-]

they should be prefixed with something human readable so you can tell a service bot api key from a human developer api key or whatever.

PunchyHamster 7 minutes ago | parent [-]

hahahaha as if humans wouldn't just give their hey to the bot

efilife an hour ago | parent | prev [-]

I hate UUIDv4, don't care about the rest. UUIDv4 is just random bytes with hyphens inserted in random places and some bytes reserved to indicate that this is in fact a UUID. This is wasteful and stupid

matja 8 minutes ago | parent [-]

You aren't supposed to store the hyphens, and that's the same for all versions.