3 ms·
That sounds like a bug that should be fairly easy to catch out. If you don't write unit tests, you're going to have a bad time (or duplicate amounts of "good t
by V-2 11y ago
That sounds like a bug that should be fairly easy to catch out. If you don't write unit tests, you're going to have a bad time (or duplicate amounts of "good time" as in this case).
- kodablah 11y agoThis could be a classic example of why unit tests (or at least striving for coverage alone and not functionality) is not good enough. What the pseudo code might have looked like: def getReleaseDate() = getStartDate() + (getTotalSentencedDays() * getGoodBehaviorCoefficient()) And say all of those functions were covered 100%, then they get the new state supreme court decision changing the contents of "getTotalSentencedDays" and even wrote new tests to make sure it included the "enhancements" and what not. Coverage 100%, unit tests appear to be in order, all done. There was no "testGetReleaseDateWithGoodBehaviorNotAppliedToEnhancements". Hard to catch this stuff when you are close to the code.
- V-2 11y agoI agree, although as you said, I'd see it as an example of coverage vs. functionality. Still, if I were to bet, I would put my money on that they had no test suite at all : ) It's a gamble, but I think my chances would be favorable : )
- snarfy 11y agoGovernment code? Most likely contractors wrote it. The last time I was a contractor working on government code it was a two week process to change the title of a window. Yeah, no test suite at all.
- cmiles74 11y agoI think it may be unreasonable to assume that the requirement passed to the developer was clear and correct. The unit test is itself predicated on the belief that the requirement is clear and correct and, in my experience, this very often is not the case. IMHO, many administrators or managers lack a strong math background and may find themselves writing requirements that involved fairly complicated arithmetic in narrative form, thus introducing considerable "gray error" and potential error. I've seen it many times in my own work.