4 ms·
practically speaking this kind of bugs gets detected immediately and is corrected immediately. so in reality, it's not that dangerous.
by slim 6y ago
practically speaking this kind of bugs gets detected immediately and is corrected immediately. so in reality, it's not that dangerous.
- JimDabell 6y agoThey do not. This reminds me of a bug I happened to come across with a cheap offshore company I had to deal with a while back (well, a very expensive consulting company that used a very cheap offshore company for development). We were dealing solely with Pound Sterling (100 pence make a pound). As part of the API requirements, they were asked to solely deal with pence in integers. They ignored the requirements and used pounds in floats. This caused rounding errors here and there. We spotted the problem as soon as we heard about the rounding errors, and asked them to correct it. Later on, our customer asked us why the items that cost £1.85 were being charged correctly, but the items that cost £1.90 were being charged at 19p. Turns out that rather than doing anything sensible, they took the float, converted it to a string, stripped out the period, then converted the string to an integer. So £1.85 became "1.85", then "185", then 185p, but £1.90 became "1.9", then "19", then 19p. They managed to put this into production before we had a chance to see it. Yes, it was a dysfunctional project. But there’s lots of them out there. If you leave a footgun like this lying around, there’s no end of companies that will not only shoot themselves in the foot but happily reload while you are scrambling to stop them.
- anitil 6y ago> they took the float, converted it to a string, stripped out the period, then converted the string to an integer. This simultaneously made my day much better, and much worse.
- akersten 6y agoI've worked on an enterprise application serving hundreds of millions of users and this exact error went out the door. So no, practically speaking, this absolutely does not get caught right away. And if the specification is this sloppy, it should be thrown out and redone.
- gnutaler 6y agoThe specification is not sloppy, it specifies precisely the wire format, and does expressly cover this problem of how the values MUST be interpreted. The specification does not cover how the application should render the amount when showing it to the user, so when applications show the amount to the user they can of course still render it in a culturally appropriate way.
- chrismorgan 6y agoIt specifies the wire format and how it must be interpreted, but deliberately leaves a big footgun in place where there was no need to do so.