“A good example is overflow detection on arithmetic, or providing bignums instead of just letting 32-bit integers wrap around. Now,
implementing those is more expensive but I believe that providing full-blown bignums is a little less error-prone for some kinds of programming.
A trap that I find systems programmers and designers of operating-systems algorithms constantly falling into is they say, "Well, we need to synchronize some phases here so we're going to use a take-a-number strategy. Every time we enter a new phase of the computation we'll increment some variable and that'll be the new number and then the different participants will make sure they're all working on the same phase number before a certain operation happens." And that works pretty well in practice, but if you use a 32-bit integer it doesn't take that long to count to four billion anymore. What happens if that number wraps around? Will you still be OK or not? It turns out that a lot of such algorithms in the literature have that lurking bug. What if some thread stalls for 2 to the 32nd iterations? That's highly unlikely in practice, but it's a possibility. And one should either mitigate that correctness problem or else do the calculation to show that, yeah, it's sufficiently unlikely that I don't want to worry about it. Or maybe you're willing to accept one glitch every day. But the point is you should do the analysis rather than simply ignoring the issue. And the fact that counters can wrap around is a lurking pitfall”
―
Coders at Work: Reflections on the Craft of Programming
Share this quote:
Friends Who Liked This Quote
To see what your friends thought of this quote, please sign up!
0 likes
All Members Who Liked This Quote
None yet!
This Quote Is From
Coders at Work: Reflections on the Craft of Programming
by
Peter Seibel5,347 ratings, average rating, 284 reviews
Browse By Tag
- love (100957)
- life (78984)
- inspirational (75539)
- humor (44228)
- philosophy (30813)
- inspirational-quotes (28702)
- god (26815)
- truth (24632)
- wisdom (24453)
- romance (24283)
- poetry (23112)
- life-lessons (22504)
- quotes (20908)
- death (20490)
- happiness (18908)
- hope (18455)
- faith (18289)
- inspiration (17223)
- travel (16858)
- spirituality (15637)
- relationships (15431)
- religion (15362)
- motivational (15239)
- life-quotes (15205)
- love-quotes (15043)
- writing (14906)
- success (14151)
- motivation (13097)
- time (12807)
- science (12055)
