Publication Date

Spring 2017

Degree Type

Master's Project

Degree Name

Master of Science (MS)


Computer Science

First Advisor

Thomas Austin

Second Advisor

Jon Pearce

Third Advisor

Robert Chun


Design by Contract, Java Contracts, Prolog


Today many large and complex software systems are being developed in Java. Although, software always has bugs, it is very important that these developed systems are more reliable despite these bugs.

One way that we can help achieve this is the Design by Contract (DbC) paradigm, which was first introduced by Bertrand Meyer, the creator of Eiffel. The concept of DbC was introduced for software developers so that they can produce more reliable software systems with a little extra cost. Using programming contracts allows developer to specify details such as input conditions and expected output conditions. Doing this makes it easy for the system to assign blame whenever software runs into some erroneous state. Once the blame is assigned it is easier for the developer to detect the cause, so that the appropriate actions can be taken to resolve the issue.

My project develops a library in Java that allows developers to write contracts for their Java programs in Prolog. These contracts are then evaluated by the library with the help of a Prolog dictionary which acts as the database. Prolog’s declarative style is a natural fit for writing contracts. With this project, I hope to simplify writing contracts for Java developers. In this paper, I review my implementation. I further discuss some performance tests to show the added overhead.