N
Nicholas Paldino [.NET/C# MVP]
I really have to disagree here. It's the same justification that is
used to permit like race conditions to crop up.
Yes, depending on the code there may be a very small chance that you
will run into the race condition (and I will concede that everyone has
different definitions of "low" and "high", as they are subjective, so
something I think has a low chance you might think that has a high chance,
etc, etc), but in the end, you shouldn't have run across it in the first
place, because you knew it could happen and didn't prevent it.
And that's what this is really about in the end. With a few extra lines
of code, you could write something that will give you a guarantee vs.
playing the odds, no matter how small those odds might be. It's my opinion
that as a discipline, software development is more akin to engineering than
anything else, and in engineering, you simply don't play the odds like that
when you can easily do something of a preventive nature.
--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)
unique with 100% probability. If that's how it appeared, I did make a
mistake, because that was certainly not my intent.
assertion that it's incorrect. I only agree for high values of "low
probability", which are actually the majority. GUIDs are in a
different league.
used to permit like race conditions to crop up.
Yes, depending on the code there may be a very small chance that you
will run into the race condition (and I will concede that everyone has
different definitions of "low" and "high", as they are subjective, so
something I think has a low chance you might think that has a high chance,
etc, etc), but in the end, you shouldn't have run across it in the first
place, because you knew it could happen and didn't prevent it.
And that's what this is really about in the end. With a few extra lines
of code, you could write something that will give you a guarantee vs.
playing the odds, no matter how small those odds might be. It's my opinion
that as a discipline, software development is more akin to engineering than
anything else, and in engineering, you simply don't play the odds like that
when you can easily do something of a preventive nature.
--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)
You seem to think I'm making the argument that GUIDs are absolutely[...]
That's overblown. What the documentation says, literally, in one
sentence, is "such an identifier has a very low probability of being
duplicated." And this is true.
Thank you for admitting your error.
unique with 100% probability. If that's how it appeared, I did make a
mistake, because that was certainly not my intent.
OK, now we're at the heart of the argument! I disagree with theNo. This is never true. Writing your code to rely on very low
probabilities of an error is incorrect. Code like that can and will
eventually fail.
assertion that it's incorrect. I only agree for high values of "low
probability", which are actually the majority. GUIDs are in a
different league.