Eiffel is an interesting programming language developed
by Bertrand Meyer and his company Eiffel Software in the 1980s. The language
was named for Gustav Eiffel, the archi-tect who designed the famous tower in
Paris. The language and accompanying methodology attracted considerable
interest at software engineering conferences.
Eiffel fully supports
(and in some ways pioneered) pro-gramming concepts found in more widely used
languages today (see class and object-oriented programming). Syn-tactically, Eiffel emphasizes simple,
reusable declarations that make the program easier to understand, and tries to
avoid obscure or lower-level code such as compiler optimizations.
Program Structure
An Eiffel program is called a “system,” emphasizing its
structure as a set of classes that represent the types of real-world data that
need to be processed. A simple class might look like this:
class
COUNTER
feature—access counter value total: INTEGER
feature—manipulate counter value increment is—increase
counter by one
do
total :- total + 1 end
decrement is—decrease counter by one do
total := total - 1 end
reset is—reset counter to zero
do
total := 0 end
end
(In this listing
language, keywords are in bold and user-defined objects are in italics. This
formatting will be done automatically as the user enters the text.) Once the
class is defined, making an instance of it is very simple:
my_counter COUNTER
create my_counter
The Eiffel compiler
itself compiles to an intermediate “bytecode” that, in the final stage, is
compiled into C, taking advantage of the ready availability of optimized C
compilers.
A unique feature of
Eiffel is the ability to set up “con-tracts” that specify in detail how classes
will interact with one another. (This goes well beyond the usual declarations
of parameters and enforcement of data types.) For example, with the COUNTER
class an “invariant” can be declared such that total >= 0. This means that
this condition must always remain true no matter what. A method can also
require that the caller meet certain conditions. After pro-cessing and before
returning to the caller, the method can ensure that a particular condition is
true. The point of these specifications is that they make explicit what a given
unit of code expects and what it promises to do in return. This can also
improve program documentation.
Implementation and Uses
Eiffel’s proponents note that it is more than a language:
It is designed to provide consistent ways to revise and reuse program
components throughout the software development cycle. The current
implementation of Eiffel is available for virtually all platforms and has
interfaces to C, C++, and other languages. This allows Eiffel to be used to
create a design framework for reusing existing software components in other
languages. Eiffel’s consistent object-oriented design also makes it useful for
documenting or modeling software projects (see modeling languages).
Eiffel was developed
around the same time as C++. Eiffel is arguably cleaner and superior in design
to the latter lan-guage. However, two factors led to the dominance of C++: the
ready availability of inexpensive or free compilers and the existence of
thousands of programmers who already knew C. Eiffel ended up being a niche
language used for teaching software design and for a limited number
of com-mercial applications using the EiffelStudio programming environment.
Eiffel has been
recognized for its contributions to the development of object-oriented software
design, most recently by the Association for Computing Machinery’s 2006 Software
System Award for Impact on Software Quality.
No comments:
Post a Comment