Let’s learn the programming language respected by Boeing


For many years, I have been a fan of development for Windows and wrote pretty much about it to this best computer magazine ever. I switched to Mac OS and UNIX with time. Working in Mac OS, I set my mind to selecting a tool for creation of platform-independent programs. What should be preferred? Java? Mono? Too boring. I settled upon… Eiffel. For the following reason.


Everything started when my eye was caught by the publication of St. Petersburg ITMO University professor Bertrand Meyer, an author and creator of Eiffel language at the same time. This language aroused my genuine interest.

Bertrand Meyer is considered to be one of the top object technology specialists, moreover, he was one of their originators and wrote a great deal of books regarding this topic. But his main merit is creation of ОО-language with contract-based programming feature — Eiffel developed by him in far-off 1985. This language can be characterized by a mechanism of memory control (garbage collection), multiple inheritance, generalized programming, static type checking, and agents (closures and lambda expressions).

In the same year, Bertrand founded ISE (Interactive Software Engineering), the company engaged in language development and support, later (in 1993) the company was renamed into Eiffel Software. This company is among top 500 most successful independent businesses in the world. At that, it should be considered, that it specializes only in development and sale of the language and programming tools which use it. It means that this language is not very popular. Because the most famous programming languages are open and/or free technologies: Python is an open source product; C/C++ have been widely recognized since the moment of creation due to their megacompany developer — AT&T (Bell Labs), who distributed them for free (because at that moment it had no right to sell software); Pascal, Lua are the results of university group research and thus free… On the other hand, commercial languages are not commonly used because of their closed nature, the exception might be only Objective-C first licensed by NeXT, and then, hereditarily, by Apple.

Eiffel is used in serious developments which affect people’s lives: in aerospace industry, in bank and financial sector… Eiffel Software clients are Boeing, Rosenberg and EMC.

In original language implementation (by Eiffel Software, which we will regard further in the article) a code, after passing the intermediate level, is transformed into text in C language and only then the compiler of the latter creates the binary code of the executable program; such approach allowed making language platform-independent. Meanwhile, there are implementations which generate the binary code directly from Eiffel language. For example, Visual Eiffel open source project was engaged therein, but stopped its development in 2007. Except for the language, the programmer is provided with a powerful integrated development environment — EiffelStudio. This system includes integrated code handling tools typical for modern programming environments, libraries for every occasion, etc. Apparently, Bertrand, following his older colleague Niklaus Wirth, applied in his language the expressiveness typical for languages of the latter: Pascal, Ada, Oberon. And this is wonderful! Although, what makes the language really delicious is the possibility of contract-based programming. There is an established opinion that a software product cannot be free from bugs, if only it is not “Hello, World”. Meanwhile, Eiffel developers claim that software they created is exactly of such kind. They refer to the mechanism of contract-based programming as a proof of this. It is based on (which is evident from the name) the contract interaction similar to business relationships. So, the client, having requested something from the supplier, undertakes to comply with preconditions, whereas the supplier undertakes to realize postconditions. For example, the client shall be sure that a table and the key field are not empty, so as to be able to update the table by inserting an element associated with this key. On the other hand, the supplier shall input the obtained element associated with the delivered key into the table and if it is completed, he shall not do anything. This is how the double check is realized. It allows to record sources in a convenient way, and EiffelStudio is furnished with special mechanisms to this end. Preconditions or postconditions may belong to the same class specifically created for this purpose. These are so called invariants. An invariant may contain one or more conditions. They are useful for regression testing and configuration control. Thus, contract-based programming represents the following realization (add-in) for common object-oriented programming: objects have more close connections in software environment.

The following EiffelStudio feature, called AutoTest, follows thence. Everybody is familiar with software development technology based on testing introduced by Kent Beck in 1999, applying which, a programmer shall write a test for a program operational code before writing this code. All that is good, and has been widely used. However, with development of technologies the approaches should improve. With a view to necessity of creating more sophisticated software, the programmer has to focus more on the core task of the app developed rather than on the code for testing thereof. AutoTest mechanism creates tests instead of the programmer; thus, it automatically performs regression testing, saving the programmer from extra efforts.

Null references are a curse of object-oriented software development. Using Eiffel language, the developer should forget about them. I.e. if car is equal to nullptr, then the following code will not cause application failure (and the end of the world) car->drive();. Eiffel compiler ensures that car will not be equal to nullptr under any circumstances. Which is why dereferencing happens without problems, and the compiler will throw the warning about a slight confusion. Such option is called Void Safety.

Whatever quantity of new and diverse threaded frameworks and libraries appears for such procedure-oriented language as C/C++, C# or Java, parallel computing problem stays acute, and capable of keeping the developer sleepless, deep in debugging. Modern age and future demand parallel processing, but it contains races, dead- and lifelocks, debugging problems and other nice things. But also in this case Eiffel can make our life easier! Due to SCOOP (Simple Concurrent Object-Oriented Programming) language extension, Eiffel allows developing stable multi-threaded applications unexposed to competitive situations.

Thus, EiffelStudio allows performing “seamless” development. It means that the same development environment is used for design (including UML-chart creation), user interface design, writing Eiffel-code, record keeping, testing and shrink-wrap application deployment, and it contains all abovementioned tools, which allows the developer to avoid using standalone aids.

Library power

To see the power of Eiffel, let’s take a glance at standard language libraries. In total, there are 12 libraries, mostly platform independent, although there are exceptions. The most important library is the basic EiffelBase, which contains basic structures and algorithms. In short, this lib includes core Eiffel-system classes: they are used for arithmetic operations and exception handling. EiffelVision 2 is a cross-platform graphics library, which allows building extended user interface for applications, working in any accepted operating system: Windows, UNIX, Linux, VMS and others. The following two libs are platform-dependent and operate in Windows only. WEL (Windows Eiffel Library) is based on Win32 API (thence dependent) and allows building applications using aids of the latter: windows, dialogs, controls, typical for Win-applications, and many other things as well.

EiffelCOM simplifies development of applications using Microsoft component model (which is obvious from lib’s name). Client-server library EiffelNet allows exchanging data structures between computers via network. EiffelTime realizes multivector data and time handling. At turning on the EiffelStore library in the application, it obtains the possibility of working with data of different databases via ODBC driver including: Oracle, SQL, Ingres, Sysbase. EiffelThread realizes multithreading support in the application; with that, it stays independent from hardware and software environment and is equally supported in all Windows NT, UNIX systems on x86/64 processors, SGI workstations and Cray supercomputers. Eiffel2Java creates an interface between the program written in Eiffel, and Java-application, thus, the latter can be requested from the former. EiffelWeb allows Eiffel based developing dynamic HTML-pages containing forms to be processed by CGI-scripts.
EiffelLex and EiffelParse libraries are used for creation of text and syntactic analyzers. They can be applied for development of translators of any kind, including compilers and interpreters.

And these are only the libraries out of the standard Eiffel pack! The list may be supplemented by purchasing necessary library from Eiffel Software, or to try your luck searching in the Open Source community.

EiffelStudio installation

EiffelStudio is an original programming environment in Eiffel language. Two options are suggested for its installation: EiffelStudio version — Enterprise Evolution Edition, and a version under GPL license. I prefer to install development tools under free license, because the trial period is normally insufficient. In such a case, installing EiffelStudio from the terminal is more convenient. But first…

Before installation of EiffelStudio, the Xcode shall be installed. I doubt you do not have it, but command line tools for it may be lacking. In such a case you should go to Apple website to Downloads for Apple Developers (you need a valid Apple ID to get there), and then, after little research, download Command Line Tools (OS X 10.9) for Xcode, the latest tools version as of the date of this article was Late December 2014.


Webpage for command line tools download

As a result, a package—disk image for installation of command line utilities—will be downloaded to your Mac hard drive. The installation is standard and creates no problems. Please note, you should run Xcode at least once after tools installation to accept license conditions; failing that, code compilation from EiffelStudio may not work in future for “undefined” reasons.

After this Unix window-based subsystem X11 shall be installed. Now it is not included in operating system standard delivery, but it is contained in XQuartz package developed by Apple. Leaping ahead: the package is needed for rasterizing Eiffel IDE window interface, and the XTerm terminal to be preferable during installation of the language and studio, is installed along with it. Download XQuartz from the website. It is a common installation package. The last version as of the article delivery date was 2.7.7.

Besides, you should install MacPorts, which is a repository of UNIX-applications for OS X. Among them — EiffelStudio. To install MacPorts, the package containing it should be downloaded from the following link. I suppose you have the latest for the moment version of Apple desktop operating system. Package content “pops out” in a standard way.

Finally, preparatory steps are over, and we launch installation of Eiffel language and system. Open preinstalled XTerm and enter: sudo port install eiffelstudio. Installation process will be launched, all necessary libraries installed and dependencies allowed. This will take a while, so you will have time to ‘lean back in the armchair’ and even have some tea.

After the process is over, some settings are to be made, otherwise nothing will work. In short, if you are using bash in XTerm (as it is by default), some changes are to be introduced in its profile. For this purpose, when in XTerm, open the profile for editing, enter and run: cat >> ~/.bash_profile. Then enter four following lines into the opened file:

Now, switching to the following line, complete entering by pressing . To activate changes, you should reload the bash profile, and for this run: source ~/.bash_profile.

Congratulations, installation and configuration completed! Now you can launch EiffelStudio, for this, enter estudio in the command line. If preliminary steps are performed correctly, your Mac will start the studio rustling its Winchester disk! Note, if you run studio under root, it won’t operate. It shall be run under real user.

Getting into EiffelStudio

As I said already, EiffelStudio is a self-contained development environment. We cannot analyze the entire integrated tools system in one article, but we have to touch some part of it.

After the previous step, the studio is launched. A window for creation of or choosing the project will appear right after the launch.

In the upper part of the window, two project templates will be shown, their number varying subject to operating system and frameworks installed. The first is Basic application (no graphics library included) — it is a template for console-based application, the second is Graphics application, multiplatform, with EiffelVision 2 — it creates window-based interface, using an indicated library.

Traditionally, we create the first type application by choosing in the list the corresponding option and pressing activated Create button.

A dialog window for project name, root class and location definition will open. As during creation of any project EiffelStudio shall compile header files, make sure, that Compile Project is marked, and then press OK. A question prompting confirmation of header compilation will appear.


Confirm header compilation?


Confirm, press OK, EiffelStudio will launch translation procedure. Let’s have a look at Eiffel-program source (choose APPLICATION in Groups bar to the right). As expected, it is not too large for a console-based application:


But looks strange. Let’s have a look at the principal points. The key word “note” is followed by the comments — project description, and therefore, this text is skipped by the compiler. Class description starts with the keyword “class”. As Eiffel supports a multiple inheritance, the ‘inherit’ block may contain several parent classes. Class constructors are described in ‘create’ section, there may be several of them, which is not surprising, though. Feature and method descriptions are placed after the keyword ‘feature’. The following word in squiggle brackets (in this case NONE) defines accessibility of class features and methods in regard to other parts of the program. Thus, the word NONE is equivalent to ‘private’ in C++ meaning nonpublic members.

Besides, in this place there may be the following words: ANY — equivalent to ‘public’ (public members) and CHILD — ‘protected’ (access only for class children, including itself). The same keywords may be used at class inheritance (access modifiers for the keyword ‘inherit’). In the above example, the description of ‘make’ (constructor) procedure is located in ‘feature’ section. Procedure body starts with the keyword ‘do’ and ends by Pascal tradition with the word ‘end’. As you see, a semicolon is not necessary in Eiffel, but this symbol is not prohibited. The ‘print’ function, which traditionally draws the text transferred in the parameter to the console, gets called inside the procedure. Single-line comments start here with a double dash symbol (–).

After a code review, it is the high time to run it, and for this, finalize the project by choosing Finalize option in the Project menu. Six compilation stages and finalization, which suggests direct translation of C-code into computer instructions, will be launched in a sequential order. The current project will be executed discreetly, and the console will show ‘Hello Eiffel World!.’

After project finalization, the executable file with *.e extension will appear in its folder.


Right off the bat, let’s have a look at files handling based on the current project. First, create a text file input.rtf (OS Х doesn’t like txt) with any contents in project subdirectory (where application.e file is located). Declare two variables in the code at the beginning of ‘feature’ block:



Please note: variables declaration by syntax is close to Pascal, with the exception of the keyword ‘var’. PLAIN_TEXT_FILE type is files which contain the sequence of ASCII-symbols. Then you should create the following two files at the beginning of the constructor — one for input and one for output:



Then every symbol is read and recorded in a loop. Eiffel has two loop forms: basic and iterative. The second is used in case of processing of collection elements (arrays, lists, etc.). The first is used in any other case. Loop recoding syntax in Eiffel differs from all the other languages, in our case it will look as follows:



The keyword ‘from’ marks the initialization block. After application of ‘read_character’ method, the ‘last_character’ feature of ‘input_file’ object will contain the read symbol. ‘Until’ block contains the condition for loop performance termination. In our case, the body, following the ‘loop’ tag will be performed until the ‘exhausted’ feature of the object being a read file becomes true (i.e. till the file is finished). Recording previously read symbol into the output file and reading the following symbol from the input file takes place here. In the end of the program, both files shall be closed by ‘close’ method:



The program is ready, test it. If everything is correct, the text output file with the text introduced in the input file, will appear in a folder with the executable file.

Window-based interface

Finally, let’s take a view at the second application template in EiffelStudio — Graphic application, multi-platform, with EiffelVision 2. At the moment of creation, following wizard step by step, we indicate the name and location of a future project, and mark the minimum set of visual elements: root menu, toolbar, etc.

After project creation, if it is finalized and launched, an application with window-based interface will appear.


Window-based application

The main application class using EiffelVision library is EV_APPLICATION. Saving that, this class initializes window subsystem utilized on the platform, for which the project is compiled (the majority of operating systems use GTK by default), this class also organizes the main loop for processing system events. EV_APPLICATION uses operability of other classes e.g. EV_TIMEOUT periodically (at appropriate intervals) and requests events using agents; on the other hand, EV_COLOR class object is engaged in filling widgets and elements. The main window is represented by ‘first_window’ object of ‘MAIN_WINDOW’ class.
First, the ‘make_and_launch’ constructor calls up the ‘default_create’ method prepared by EV_APPLICATION, then a window is created and shown in a ‘prepare’ procedure (MAIN_WINDOW class object), and, finally, the application is launched for execution by ‘launch’ method, and, as a result, we see the window of the program.


Eiffel contains an enormous quantity of syntax differences as compared with standard (C-type) languages: class, variable, method, and array declaration; conditional, looping structures; preconditions, postconditions, class invariants; client and supplier relationships, and many other language structures are contained in Eiffel. Together they are intended to improve the quality of software developed by making it safer and more reliable. These steps are made by language developers to make the work of application programmers more efficient.

The article is over, and yet we have not managed to review all Eiffel language features. It is just natural, as the language author dedicated thousand-page volumes to its description! It is a powerful, sophisticated, but very interesting language. It is a new take to software development, a new toolkit, and a fresh approach.

Naturally, examples are of great help when learning the language. Eiffel is not an exception in this regard, Eiffel_Examples folder contains a tremendous collection of examples of all kinds: from console-based calculator to windows-based web-browser.

Eiffel has influenced directly many modern languages, among which Delphi, C#, Ruby and others. Although this language was also affected by Pascal, ALGOL, it has structures which can’t be found in other programming languages.

Bertrand Meyer states, “C is not the language to be used by a programmer for applications influencing human lives, C, at least, should play an intermediate role only, which is created by a safer and more natural language.”

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">