4 ms·
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
by jeffrallen 8mo 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.
- whateveracct 8mo agoI treat UUIDv4s as 128 random bits and it triggers ppl.
- masklinn 8mo agoTo be fair that’s literally just a waste of resources. If you want 128 random bits just get 128 random bits from the underlying source, unless your host langage is amazingly deficient it’s just as easy.
- gzread 8mo agoIt needs several non-random bits to mark it as a v4 or it's not a uuidv4
- sevg 8mo agoUUIDs 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 8mo agoThat 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.
- deleted 8mo ago[deleted]
- chuckadams 8mo agoHas anything post-dating the DCE-RPC era ever looked at the version of a UUID?
- beart 8mo agoUUIDs 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 8mo agoThe 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.
- beart 8mo agoI stand corrected. I was thinking of the sequential nature of uuid 7, or SQL servers sequential id.
- fragmede 8mo agothey 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 8mo agohahahaha as if humans wouldn't just give their hey to the bot
- sethammons 8mo agoThat misses the point. The point is for easy validation that the key was generated appropriately. Many api keys have a standard prefix for just this reason. It especially helps on documentation where the key name might be confused with the value: "your key starts with hnkey-"
- efilife 8mo agoI 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 8mo agoYou aren't supposed to store the hyphens, and that's the same for all versions.
- efilife 8mo agoWhat if I want an ID in the URL? Parse it back and forth? And what if for example, nodejs's UUID api only gives me the string representation of the ID?
- matja 8mo agoTo minimize the storage space while having a URL-safe representation, yeah you'd want to serialise/deserialise on the boundary of presenting it to API consumers. I think the same for any ID that has an efficient binary representation as well as needing to represent it in ASCII.
- Dylan16807 8mo agoIs reserving 6 bits really that bad? You can use different encodings based on context, just like with a random blob of bytes.
- HendrikHensen 8mo agoWhy the hate though? Is someone forcing you to use them against your will? If you need 128 bits of crypto.Rand() for your usecase, you can just use that right?