Dr. Bertrand Meyer, the man behind the Eiffel language the famous Design by Contract approach had come to our company to deliver a lecture. Although I did not know much about this approach, I attended the talk along with a few of my colleagues.
The talk was nice, with timely comic interludes. He talked about Eiffel as a language, the various features it provides, how it is better than any other existing language :-) and of course finally the Design by Contract approach.
The whole approach is centered around contracts - specified as pre-conditions and post-conditions. It is like signing a contract between the caller and the callee.
He gave an example of a water tank with two valves - input and output valve. The function of filling the tank is done by a method "fill". Now the pre-conditions for this method are:
1. Input valve should be open
2. Output valve should be closed (otherwise as he mentioned, it will take a long time to fill it :-))
The post-conditions are that:
1. Input valve is closed
2. Output valve is closed
3. Tank is full
This seems like a difficult thing to achieve in languages like .Net, Java, C++, but Eiffel language provides support for defining such contracts, thus making them a part of the design process itself. He gave examples of this language being used in many mission critical applications, one of the examples was the Chicago trade center - with terminals and monitors showing real-time stock data almost 24*7.
I do not know much about this approach, but as one of my colleagues who attended the talk with me said - He has been following this technique and approach with C++ and has found it to be very effective.
Tuesday, September 12, 2006
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment