Taking Eiffel for a Spin
Lately I’ve been playing around with a multitude of languages, hoping to not only have yet more to add to my list of fluent languages to brag about, but to also gain further insight in other implementations and design from them. For this reason, I decided to play with Eiffel over the weekend.
Eiffel is a rather interesting language with a multitude of interesting features. It’s well known that it is organized around concepts of Design By Contract, which allow you to explicity set preconditions and postconditions for method calls, as well as invariants (more on that later). For example, say I have a class Employee who (for whatever reason) cannot be younger than 18 or older than 60.
feature
age:INTEGER
set_age(a:INTEGER) is
require
a >= 18 AND a <=60
do
age := a
end
Another feature I equally liked is the concept of agents, which felt more or less like an object oriented version of a loop. Basically, say I have a collection of people and, for each person, I want to call some object method to calculate their interest rate.
people.do_all(agent calc.calculate_interest(?))
There are plenty of other interesting features to talk about, such as generics, multiple inheritence, and the Command-query seperation principle, but I am currently pressed for time. Don’t worry, I’ll follow up… this is definiately going to be my “language of the week” this week. ![]()
If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!








November 20th, 2006 at 4:36 pm
Shouldn’t your age restriction (a >= 18 and a
November 20th, 2006 at 4:37 pm
PS. It looks like the < symbol broke my previous post…
November 27th, 2006 at 8:52 am
Yeah that’s not good… looks like it was chopped off before the comment went into the database… guess I’ll have to fix that.