So he created a 'solution' where no problem exists. At least, TIL an new word: slug.
So he created a 'solution' where no problem exists. At least, TIL an new word: slug.
>No guarantee that we're the only person reading this value, right now
>No guarantee that the ID we'll choose will be unique a few µseconds from now.
The problem exists in the newer version. If anything, the developers created a problem where none existed, not him. They traded consistency for simplicity without a clear mention of the possible race conditions.
That's why you let the database atomically create the next id for you. There is no problem. You either get the next unique id or you have to try again.
Sorry, but slugs serve a real purpose, so your solution is only a solution in the sense that walking is a solution for a broken down car.
This doesn't replace slugs, at all - the slugs are still generated, this replaces the SQL unique sequencer. The SQL sequencer which isn't universally supported, and has a different API on every platform.. many modern applications have Redis or a similar atomic structure store which could provide an interim solution, short of building a purpose built ticket provisioning system such as that employed by Flickr.