Lock in $30 Savings on PRO—Offer Ends Soon! ⏳

Identify All the Things With UUIDs! (AtlantaPHP...

Identify All the Things With UUIDs! (AtlantaPHP May 2016)

Universally unique identifiers (UUIDs) are a fun and exciting way to identify things. We can issue UUIDs forever and never run out; they're practically unique! Join this whirlwind adventure in search of the perfect identifier to find out why UUIDs might be good for your projects.

Ben Ramsey

May 05, 2016
Tweet

More Decks by Ben Ramsey

Other Decks in Programming

Transcript

  1. universally unique There are 1632 possible UUIDs “only after generating

    1 billion UUIDs every second for the next 100 years, the probability of creating just one duplicate would be about 50%” — Wikipedia, UUID
  2. for ($i = 0; $i < 5; $i++) { echo

    Uuid::uuid1()->toString(); echo "\n"; }
  3. for ($i = 0; $i < 5; $i++) { echo

    Uuid::uuid4()->toString(); echo "\n"; }
  4. $factory = new UuidFactory(); $generator = new CombGenerator( $factory->getRandomGenerator(), $factory->getNumberConverter()

    ); $codec = new TimestampFirstCombCodec( $factory->getUuidBuilder() ); $factory->setRandomGenerator($generator); $factory->setCodec($codec); Uuid::setFactory($factory); for ($i = 0; $i < 5; $i++) { echo Uuid::uuid4()->toString(); echo "\n"; }
  5. THANK YOU. ANY QUESTIONS? If you want to talk more,

    feel free to contact me. benramsey.com @ramsey github.com/ramsey [email protected] Identify All the Things With UUIDs Copyright © 2016 Ben Ramsey This work is licensed under Creative Commons Attribution- ShareAlike 4.0 International. For uses not covered under this license, please contact the author. Ramsey, Ben. “Identify All the Things With UUIDs.” AtlantaPHP. Insight Global, Atlanta. 5 May 2016. Conference presentation. This presentation was created using Keynote. The text is set in Chunk Five and Helvetica Neue. The source code is set in Menlo. The iconography is provided by Font Awesome. Unless otherwise noted, all photographs are used by permission under a Creative Commons license. Please refer to the Photo Credits slide for more information. bram.se/ramsey-uuid lj bram.se/atlphp-uuids
  6. PHOTO CREDITS 1. “38-365 Fingerprint” by Bram Cymet 2. “Baby

    Feet” by Katelyn Kenderdine 3. “Security door” by reynermedia 4. “Hello My Name Is.... 221/365” by Robert Occhialini 5. “Random” by Vladimer Shioshvili 6. “Hello! My Name Is JEDi.” by Tyrone J Moore 7. “Curvy Road Ahead” by Kit Ng 1 2 3 4 5 6 7