Assertions, or more generally “Programming by contract”, have gained widespread acceptance in the computer science community as a means for correct program development.
However, the literature lacks an empirical evaluation of the benefits a programmer gains by using assertions in his software development. This paper reports two controlled experiments that close this gap. Both experiments compare “Programming by contract” to the traditional programming style without assertions.
The evaluation of the first experiment suggests that assertions decrease the programming effort for the extension of existing software, measured as time needed to finish the task, while the programming effort slightly increases during the development of new code.
The second experiment shows that the programming effort tended to be larger with assertions than without. In addition, it shows that the reliability of the written programs slightly increases with the usage of assertions compared to the programs written without assertions.
To view this external content in full, download the complete paper from the Karlsruhe University articles archive.