The basic concepts of DbC are preconditions, postconditions and class invariants. JJ is designed for beginning programming, but JJ also contains some advanced features, such as DbC, for instructors who wish to introduce these concepts early on.
Full featured Design by Contract is an invaluable tool for large software systems, particularly for reuse. Unfortunately, for full featured object oriented languages such as Eiffel and Java defining and implementing Design by Contract can be quite complex. Indeed, Design by Contract is not yet integrated into Java.
Fortunately for you, the JJ instructor or student, JJ is not a full featured object oriented programming language (there is no inheritance) so the Design by Contract definition is simple and straightforward. Fortunately, the same holds for us, the JJ designers and implementors: the JJ Design by Contract definition and implementation is simple and straightforward.
The JJ commands for Design by Contract are:
Is Design by Contract really that simple? For JJ, yes it is. There are a few rules that make this DbC definition work for JJ, rules that may be a little too restrictive for full featured object oriented langauges, but rules that are more than reasonable for a beginner's language.