Eiffel programming language

From Exampleproblems

Jump to: navigation, search

Eiffel is an object-oriented programming language which emphasizes the production of robust software. Its syntax is keyword-oriented in the ALGOL and Pascal tradition. Eiffel is strongly statically typed, with automatic memory management (typically implemented by garbage collection).

Begun in 1985, Eiffel is a mature language with development systems available from multiple suppliers. Despite this maturity and a generally excellent reputation among those who are familiar with it, Eiffel has failed to gain as large a following as some other object-oriented languages. The reasons for this lack of interest are unclear, and are a topic of frequent discussion within the Eiffel community.

Distinguishing characteristics of Eiffel include design by contract (DbC), liberal use of inheritance including multiple inheritance, a type system handling both value and reference semantics, and generic classes. Eiffel has a unified type system—all types in Eiffel are classes, so it is possible to create subclasses of the basic classes such as INTEGER.

Eiffel has operator overloading, including the ability to define new operators, but does not have method overloading.

Contents

Elegance, simplicity, or restrictiveness?

The Eiffel language aims to promote clear and elegant programming. Eiffel emphasizes declarative statements over procedural code, and eliminates the need for bookkeeping instructions.

Eiffel intentionally limits stylistic expression, providing few means for clever coding tricks or coding techniques intended as optimization hints to the compiler. Some software developers feel constrained by Eiffel's simplicity and compiler-enforced structure; the language has been referred to as a "bondage and discipline" language.

In contrast, others feel that the simplicity of the language not only makes the code more readable, but also allows a programmer to concentrate on the important aspects of a program without getting bogged down in implementation details. Eiffel's simplicity is intended to promote simple, readable, usable, reusable, reliable and correct answers to computing problems. Eiffel seeks to produce a quality software system over anything else.

Lexical simplicity

Eiffel is not case-sensitive. Keywords and identifiers can be written in any combination of upper and lower case. The tokens MaKe, make, and MAKE all refer to the same identifier. Coding standards, however, generally prescribe the use of all-capitals for class names, all-lower-case for variables and method names, and initial capitals for constants, with underscores separating words.

Eiffel's syntax can be parsed without requiring end-of-instruction markers. The use of semicolons as instruction terminators or as instruction separators is left to the discretion of the programmer. Putting a semicolon in or leaving one out makes no difference, except in the unusual case of an instruction starting with a left parenthesis. Most Eiffel programmers choose to omit semicolons except when putting multiple statements on a line.

Eiffel requires that sections and clauses appear in a specific order.

In contrast to most curly bracket programming languages, Eiffel does not let expressions be used as instructions, nor instructions be used as expressions. Thus, a routine which returns a value can only be used in expressions, while a routine which does not return a value can only be invoked as an instruction.

This philosophy—that expressions and statements are fundamentally different in nature—is expanded into the concept of Command-Query Separation (CQS). Under CQS, a query routine (a function which returns a value) must not change the state of the object, while a command routine will change the state of the object but will not return a value. CQS is strongly recommended for Eiffel programming, but is not actually enforced by the Eiffel system.

Unlike most programming languages, Eiffel is not normally displayed in a monospaced typeface. The recommended display style is to use a proportional typeface. Keywords are shown in bold, user-defined identifiers and constants are shown in italics. Standard upright (roman) style is used for comments, operators, and punctuation marks.

Syntactic simplicity

Eiffel has only six basic executable instructions:

  • assignment
  • object creation
  • routine call
  • conditional
  • iteration
  • choice (case)

Unlike many object-oriented languages, but similar to Smalltalk, Eiffel does not permit storing into fields of other objects. The assignment instruction can only change the value of a field of the current object, or a local variable of the current routine. All changes to other objects must be accomplished by calls to methods of that object. Direct access to fields of other objects is "read only" in Eiffel.

The iteration (loop) instruction in Eiffel does not provide a field or clause which will step the loop. The programmer must express the stepping as part of the loop. For example:

  from i := 0 until i >= 10 loop
     my_array.put (0, i)
     i := i + 1
  end

The example above also illustrates that Eiffel treats arrays simply as instances of the class ARRAY, providing access in the form of routine calls, in line with object-oriented ideas. Eiffel compilers optimize this access.

Eiffel's procedural coding is strictly structured. There are no instructions for exiting a loop or routine early.

Non-object-oriented operations

Eiffel is a purely object-oriented language. Any coding which must be "close to the machine" is expected to be done in C. Eiffel provides a straightforward interface to C routines, including allowing for straight C calls within Eiffel code. Eiffel is generally closely connected to C: three of the four Eiffel compilers output no object or machine code, but only C source code as an intermediate language, to submit to a C compiler, for optimizing and portability.

Background of Eiffel

Eiffel was originally developed by Bertrand Meyer and his company Interactive Software Engineering (ISE), since renamed Eiffel Software, Inc. Eiffel closely follows Dr. Meyer's work in Object Oriented Software Construction, Second Edition. Eiffel differs from most popular languages in several ways.

The goal of the language, libraries, and programing methods is to create reliable, reusable software modules. It supports multiple inheritance, genericity, polymorphism, encapsulation, and parameter covariance. Its most important contribution to software engineering is Design by contract (DbC), in which assertions, preconditions, postconditions, and class invariants are used to assist in assuring program correctness without sacrificing efficiency.

Eiffel also offers multiple class inheritance. Many people (such as the designers of Java) have objections to multiple inheritance. The Eiffel implementation of multiple inheritance, in the opinion of its supporters, successfully meets these objections.

Eiffel's design is closely based on Object-Oriented Programming (OOP) theory, with less influence from other paradigms or support for legacy code. The language has formal support for abstract data types. In accordance with Self Documentation, a software text should be able to reproduce its design documentation from the text itself. Eiffel accomplishes this by using a formalized implementation of the Abstract Data Type.

EiffelStudio, an integrated development environment for Eiffel, offers an object-oriented interface for software engineering. However, many programmers dislike it because its user interface is very different from other integrated development environments. There are two alternative open source implementations, [Smart Eiffel] - the GNU implementation, and [Visual Eiffel], which provides a more "traditional" interface. So does EiffelEnvision, a plugin for Microsoft Visual Studio which allows users to edit, compile, and debug Eiffel apps from within the excellent MS Visual Studio IDE. EiffelStudio and EiffelEnvision are only free for non-commercial use, though.

Specifications and standards

The first (great) steps have been done by Bertran Meyer, who initiated the [Eiffel NICE consortium] to standardize the language and base libraries. As time passed on B. Meyer moved from Eiffel NICE to ECMA perhaps because he and his company (Eiffel Software Inc.) counts more there.

On the 21 June 2005 the European Computer Manufacturers Association (ECMA) approved the first international standard for Eiffel ECMA standard 367, Eiffel Analysis, Design and Implementation Language

This standard is not accepted by the complete Eiffel community, and especially the SmartEiffel team has decided to fork the language, because they think the ECMA standard throws away important principles of the original language. Most notable differences are: - SmartEiffel is case-sensitive and this behaviour can no longer be turned off - No access to variables within a C++-class. Only return-values of functions are accessible from within SmartEiffel

The standard cites the following as earlier Eiffel Language specifications:

  • Bertrand Meyer: Eiffel: The Language, Prentice Hall, second printing, 1992 (first printing: 1991)
  • Bertrand Meyer: Standard Eiffel (revision of preceding entry), ongoing, 1997-present, at Betrand Meyer's ETL3 page, and
  • Bertrand Meyer: Object-Oriented Software Construction, Prentice Hall: first edition, 1988; second edition, 1997.

The ETL3 page requires a password for access which can be found at Bertrand Meyer's Home Page under Work in progress

Differences between ISE Eiffel and other implementations

  • EiffelBase, a part of the ISE Eiffel library which has been released under an ISE open-source license, does not compile properly on SmartEiffel. The Gobo library documentation explains that despite heroic efforts, EiffelBase was impossible to port to SmartEiffel. The documentation recommends against using EiffelBase and mourns the number of free Eiffel libraries that depend on it.

Hello World

class HELLO_WORLD
create
   make
feature
make is
do
io.put_string ("Hello, world!%N")
end
end

sk:Eiffel (programovací jazyk) de:Eiffel (Programmiersprache)

Argan Oil
Natural Skin Care
Organic Skin Care
visitor stats