Assertions in modern software engineering practice
T. Hoare · 2005
Assertions play many related roles in Microsoft programming practice. Their primary purpose is to instrument code with test probes that will detect errors as close as possible to their place of occurrence. They are also used for program documentation, to assist in the further development of high-volume legacy code for delivery in later releases. They are beginning to be used to guide optimising compilation, and to suppress spurious warnings from a program analysis tool. Assertion failure is used to classify multiple occurrences of the same defect, and so ensure that it is cleared only once. Finally, assertions are now increasingly shipped to customers, to reduce the risk of crashes on the customer’s machine. My early research into programming theory was motivated by the hope that assertions would be used to specify the criterion of total correctness of a program, and to prove that the program implements its specification, without risk of error. Ironically, these are two purposes for which they are almost never used.