Misplaced Pages

Eiffel (programming language)

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.

This is an old revision of this page, as edited by Bertrand Meyer (talk | contribs) at 18:29, 22 August 2006. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Revision as of 18:29, 22 August 2006 by Bertrand Meyer (talk | contribs)(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
Eiffel
Paradigmobject-oriented
Designed byBertrand Meyer
DeveloperBertrand Meyer & Eiffel Software
First appeared1986
Stable release4.2 / Feb 6, 1998
Typing disciplinestatic typing, strong typing
Major implementations
EiffelStudio, SmartEiffel, Visual Eiffel
Influenced by
Ada, Simula, Z
Influenced
Sather, Ruby, Java, C#

Eiffel is an ISO-standardized object-oriented programming language, based on a conscious design methodology, intended for the production of quality software with a particular emphasis on extendibility, reusability, reliability and programmer productivity.

With roots going back to 1985, Eiffel is a mature language with development environments available from multiple suppliers. Although less well known than some other object-oriented approaches, Eiffel is used by large projects in various industries (finance, aerospace, health care, games and others) as well as for teaching programming in academia.

The language design is closely connected with the method, based on a set of principles: Design by contract, Command-query separation, Uniform access principle, Single choice principle, Open-closed principle, Option-Operand separation and others.

Many concepts initially introduced by Eiffel have later found their way into other languages such as Java and C#, and Eiffel continues to try language design ideas, particularly through the ECMA/ISO standardization process.

Overview

Key characteristics of the language, explained in more detail below, include:

  • Mechanisms supporting Design by contract (routine pre- and postconditions, class invariants), tightly integrated with the inheritance mechanism and other language constructs.
  • Object-oriented program structure; classes are the basic decomposition unit.
  • Static typing.
  • Support for automatic memory management, typically implemented by garbage collection).
  • Central role of inheritance including multiple inheritance and mechanisms to make it safe (renaming, redefinition, "select", non-conforming inheritance).
  • A uniform type system handling both value and reference semantics, where all types including basic types such as INTEGER are based on classes.
  • Genericity, constrained and unconstrained.
  • "Agents" (objects wrapping computations, closely connected with closures and lambda calculus.
  • "Once" routines (evaluated only the first time around), for object sharing and decentralized initialization.
  • Keyword-based syntax ALGOL/Pascal tradition but separator-free (semicolon is optional); operator syntax available for routines.

Design goals

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 shuns coding tricks or coding techniques intended as optimization hints to the compiler. The aim is not only to make the code more readable, but also to allow programmers to concentrate on the important aspects of a program without getting bogged down in implementation details. Eiffel's simplicity is intended to promote simple, extendible, reusable and reliable answers to computing problems. Compilers provide extensive optimization techniques such as automatic inlining which remove part of the burden of optimization from the programmer, with the aim of producing extremely efficient code comparable to e.g. C++.


Basic instructions

Eiffel has only six basic executable instructions:

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

Unlike many object-oriented languages, but like Smalltalk, Eiffel does not permit an assignment into fields of other objects, as this violates the principles of information hiding and data abstraction. 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 features of that object.

The loop instruction includes a from clause that takes care of loop initialization. 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 control structures closely follow the principles of structured programming; every block is one-entry-one exit.

Interfaces to other tools and languages

Eiffel is a purely object-oriented language but provides an open architecture for interfacing with "external" software in any other programming language.

It is possible for example to program machine- and operating-system level operations in C. Eiffel provides a straightforward interface to C routines, including support for "inline C" (writing the body of an Eiffel routine in C, typically for short machine-level operations).

Although there is no direct connection between Eiffel and C, all of the current Eiffel compilers except one (Visual Eiffel) output C source code as an intermediate language, to submit to a C compiler, for optimizing and portability. On .NET, the EiffelStudio compiler directly generates CIL (Common Intermediate Language) code for the .NET virtual machine. The SmartEiffel compiler can also output Java bytecode.

Background

Eiffel was originally developed by Eiffel Software, a company founded by Bertrand Meyer (originally called Interactive Software Engineering Inc. or ISE). 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, type-safe conversions, 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 available under both an open source and a commercial licenses, offers an object-oriented environment for software engineering, using some innovative user-interface techniques such as Pick-And-Drop. There are two alternative, also open source implementations, SmartEiffel - the GNU implementation, based on an older version of the language, 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 Microsoft Visual Studio IDE. EiffelStudio and EiffelEnvision are only free for non-commercial use, though.

Originally, the language Sather was based on Eiffel, but it has diverged, and now includes several functional programming features.

Specifications and standards

The Eiffel language definition is an international standard of ISO, the International Standards Organization. The standard was developed by ECMA International and its first version approved by ECMA on 21 June 2005 as ECMA standard 367, Eiffel: Analysis, Design and Implementation Language. The second edition was adopted by ECMA in June 2006 and in the same month by ISO. Its text can be found, and used free of charge, on the ECMA site. The ISO version, standard ISO/IEC DIS 25436, has different formating but its text is identical.

Eiffel Software and Gobo have committed to implementing the standard; Eiffel Software's EiffelStudio 5.7 implements some of the major new mechanisms, in particular inline agents, assigner commands, bracket notation. The SmartEiffel team has turned away from this standard to create its own version of the language, which they believe to be closer to the original style of Eiffel. Object Tools has not to date expressed a position.

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 Bertrand 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 SmartEiffel and other implementations

  • SmartEiffel is currently unable to compile the open-source EiffelBase library from Eiffel Software.
  • SmartEiffel is case-sensitive.

A "Hello World" class

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

References

  1. ECMA International: Standard ECMA-367 —Eiffel: Analysis, Design and Programming Language 2nd edition (June 2006); available online at www.ecma-international.org/publications/standards/Ecma-367.htm
  • Object-Oriented Software Construction, Second Edition, by Bertrand Meyer, Prentice Hall, 1997, ISBN 0-13-629155-4 (see its Misplaced Pages article); contains a detailed treatment of the concepts and theory of object technology, which led to the design of Eiffel. Available in several languages.

See also

External links


Categories: