←back to thread

303 points FigurativeVoid | 4 comments | | HN request time: 0.589s | source
1. cratermoon ◴[] No.41843334[source]
Question I like to ask my colleagues. Suppose you have a program that passes all the tests. Suppose also that in that program there is a piece of code performs an operation incorrectly. The result of that operation is used in another part of the code that also performs an operation incorrectly, but in such a way that the tested outcome is correct.

Does the code have 0 defects, 1 defect, or 2 defects?

replies(1): >>41844153 #
2. userbinator ◴[] No.41844153[source]
I can understand 0 and 2, but what's 1? The "I don't know how to count" answer?
replies(2): >>41848741 #>>41849480 #
3. Izkata ◴[] No.41848741[source]
The second part could instead be more like "detects an edge case and handles it, accidentally working around the first defect".
4. cratermoon ◴[] No.41849480[source]
It could be counted as a single defect because both pieces of code must be corrected to keep the test happy.