3 ms·
> So, if there are no preconditions, any behavior of the function being called is as correct as any other behavior. Umm, no. If the program is supposed to unco
by kazinator 3y ago
> So, if there are no preconditions, any behavior of the function being called is as correct as any other behavior.
Umm, no. If the program is supposed to unconditionally produce the output "Hello", but it instead produces "Goodbye", then it is incorrect. Unconditionally means not that there are no preconditions but that the precondition is T (true). If the precondition is constant truth, it means that there are no circumstances under which the program can be excused for not satisfying the postcondition (e.g. producing "Goodbye" rather than "Hello").
Correctness is almost irrelevant here, because the question is about breakage. It is in fact the change in specification which is behind the breakage. The function is correctly implementing its specification at all times; the correctness of my example strlen is never being called into question. What it means for it to be correct has been changed, and the function's definition followed suit.
- fiddlerwoaroof 3y agoA breaking change is one that breaks code that uses it correctly. This means that the code that uses it uses it according to its specification. Breaking code that uses your code incorrectly should happen early and often because using code incorrectly is a bug in the using code, not the code being used.
- kazinator 3y agoThat's just a blame game that is neither here nor there to the user who can't open his ten-year-old word processing document with the latest version.
- fiddlerwoaroof 3y agoIt makes all the difference in the world for that problem. It’s how you build programs that can be maintained and evolved in a consistent fashion long-term.