Skip to Main Content
Design by contract allows to develop more reliable and robust applications. Software is reliable if it can perform its work as it was specified, and it is robust if it can control abnormal situations. In this paper it is proposed a methodology to diagnose errors (bugs) in software. It is based on the combination of design by contract, model based diagnosis and constraint programming. Contracts are specified in the design by contract using asserts. These asserts with an abstraction of the source code are transformed into constraints, and these constraints compose the system model. A goal function is established according to the constraints of the system model. With this function is possible to detect which asserts or source code blocks are incorrect. It is proposed a typical diagnosis problem with the design by contract and the source code. The originality of this work is based in the transformation of contracts and source code to constraints in order to obtain which asserts and source code blocks are not consistent with the specification. To obtain these results it is proposed a novel methodology that automatize this task using constraint programming.