If you found the contents in this blog useful, then please make a donation to keep this blog running. You can make donations via Skrill with email address

Wednesday, August 10, 2011

Eiffel Programming

As part of degree studies I had to learn a Programming Language named Eiffel which enables to write programs which doesn't unintentionally kill or injure people/assets. Simply put it enables to write Secure programs.

The Eiffel language many features to make this possible such as Design by Contract, Multiple Inheritance, Method Rename and so on.

While doing Eiffel I wanted to try out a Small thread based code I did in Java in Eiffel. The code just takes in a String and prints one character after another in the console like in those Action Movies where the secret location name will be printed.

After some reading I managed to do this with the following code in Eiffel.

slow_prompt(text : STRING) is

valid_text : text /= void
counter : INTEGER
counter := 1;
counter > text.count
io.put_character ( (counter));
sleep(7812500); -- Sleep for 7812500 nano seconds
counter := counter + 1;

For this method to work however the class EXECUTION_ENVIRONMENT needs to facility inherited.

No comments: