Eiffel and Design by Contract

In the first talk of the second day, by Bertrand Meyer himself, he will talk about Eiffel and Design by Contract.

Meyer talks about how Eiffel was designed, he considers keywords like ‘desserts’, a nice gift you should not eat every day. Sometimes, features are removed or improved. Bertrand stated this is different from other languages, that slowly evolve and grow very large, since their creators want to have backward compatibility.

An example: If type T inherits from U, and U has a function f, you cannot just call f on a variable a:T. In C-based languages the compiler just tries, in Eiffel you used to be able to use b?=a (a conditional cast) but this feature was removed and replaced by another construct. Lesson learned: if you provide people with a new way of doing something, they will accept change.

Interesting about the design of Eiffel is that its underlying ideas are not about language design, but about software design. Eiffel is there, according to Bertrand, to help you design great software and to get out of the way. Eiffel wants to be more than a programming language, it is meant to be one language (and tool) for implementation, but also analysis, design and maintenance. The problem, obviously, with using different languages from design and implementation (f.i. UML and C) is to keep those models in sync.

For analysis, Eiffel supports constructs like require, ensure and invariant, that can be put in ‘deferred’ classes. These look like program text and can be presented to the compiler, but they will not be executed.

(taken from Eiffel for beginners)

This all relates to the single model principle: all the information about a software system should be in the software text. Different views on this single model can be presented, but all must show the same model.

More after the break!

Bertrand is also on Twitter, although he does not tweet that much: @Bertrand_Meyer

This post was visited 129 times.