← Previous · All Episodes · Next →
UUIDs Gone Wild: The Quirky Misadventures of Regex and Randomness Episode

UUIDs Gone Wild: The Quirky Misadventures of Regex and Randomness

· 01:23

|

In this episode, we dive into a quirky and controversial take on generating UUIDs that’s both inefficient and delightfully wrong. The article "CodeSOD: Uniquely Expressed" from The Daily WTF highlights a method where instead of using a standardized library, a developer opted to "fill in the gaps" using regular expressions. The piece explains how the code crafts a UUID string by replacing characters in a format string with random hexadecimal digits—a technique that, while it works, is both awkward and prone to errors, such as "a high probability of collisions due to bad randomness." The editor laments this approach by noting that it “confuses the representation of the data with the reality of the data,” because a UUID is fundamentally 128 bits of numerical data, not just a dash-separated hex string.

Key Points:

  • The method uses a regular expression to replace placeholders in the UUID format string.
  • It avoids the conventional and more reliable libraries for UUID generation.
  • The approach is criticized for being inefficient and not truly representing the nature of UUIDs.
  • The article humorously points out the pitfalls of this method, including randomness issues that increase the risk of collisions.
  • A memorable quote from the article is: “a high probability of collisions due to bad randomness.”
    Link to Article

Subscribe

Listen to jawbreaker.io using one of many popular podcasting apps or directories.

Apple Podcasts Spotify Overcast Pocket Casts Amazon Music
← Previous · All Episodes · Next →