Jump to content

Why Eiffel Might Be Worth a Second Look


Recommended Posts

Why Eiffel Might Be Worth a Second Look

By Coryoth in Technology

Thu Nov 02, 2006 at 12:24:17 AM EST

Tags: Eiffel, EiffelStudio, Programming Languages, Software (all tags) Software

Eiffel is one of those academic languages nobody uses right? Well, sort of. Certainly Eiffel has greater interest among the academic community than outside it, but then other languages like Haskell have far more academic interest due to their purity. Eiffel is a surprisingly pragmatic language, and as a result it does have a solid niche market in industry. Over the last few years, however, there have been some changes that make Eiffel a more interesting proposition - it might be worth a second look.

The Right Tool For the Job

Let's get this out of the way at the start: while Eiffel is worth a second look, it does depend on what you're looking for in a language. Eiffel fits in nicely as an alternative to Java or C++ for developing large applications. If you're leaving Java for more dynamic languages like Ruby then Eiffel isn't going to be for you - you can probably quit reading here. On the other hand if you're using Java for large scale projects and appreciate the discipline it imposes, then Eiffel is definitely worth more than just a glance. Eiffel was designed with a pragmatic eye toward the development and maintenance of large scale software systems, and is remarkably good at it.

What is Eiffel?

Eiffel is an Object Oriented language, akin to Java - If you know Java or C++ learning Eiffel is utterly straightforward. Eiffel has many of the same features as Java or C++, but often offers improvements. For instance Eiffel has garbage collection like Java, but has memory efficiency on par with C++. Eiffel's type system is stronger, more robust, and safer than either C++ or Java. Eiffel offers generics like Java (or templates in C++), but they are more naturally integrated into the language (Eiffel had generics from the outset) and much easier to understand and use. Eiffel has multiple inheritance like C++, but has a much more powerful system for dealing with the issues that arise - which is to say that multiple inheritance in Eiffel just works, and isn't something to avoid (quite the contrary, it is used regularly!). Eiffel also has some novel features such as expanded types (which offer a distinct improvement over primitive types and autoboxing), non-conforming inheritance (which allows for partial implementation interfaces, among other things), and agents, which allow for closures. The feature Eiffel is most known for, of course, is Design by Contract, which integrates pre- and post-conditions and class/object invariants into the language and aids in correctness and documentation of software. To get a feel for the look of Eiffel you can browse through some examples on LiteratePrograms, or this comparison of C++ and Eiffel for longer code samples. Eiffel has had most of these features for some time now of course - so what is it that makes Eiffel worth a second look?

Eiffel is Now GPL Software

A GPL Eiffel compiler, SmartEiffel, has been around for a while (and even sports a variety of interesting features not found in commercial Eiffel compilers), but recently ISE re-licensed EiffelStudio, their commercial Eiffel IDE, libraries, and compiler system, under a dual licensing scheme. EiffelStudio is now GPL software. The catch is that if you want to release software under a non-GPL license you have to buy a commercial license. Then again, given that a great deal of large scale software projects are bespoke systems that may as well be GPL, this isn't necessarily a loss for many cases. If you desperately need to sell your software and keep the source then EiffelStudio will set you back around $5000.

Aside from being free to use, making EiffelStudio GPL has also pushed development along. The upcoming release of EiffelStudio 5.7 (the first major release after going GPL) has a lot of significant improvements, and is, in my opinion, a much nicer system to look at and work with. The roadmap also has plenty of other new and useful features appearing in the not too distant future. EiffelStudio is a first rate IDE (download the preview releases of 5.7 and try it out), and GPL development has helped round it out and shave off many of it's niche quirks for a more mainstream audience.

Eiffel is Fast

One of the first things that Eiffel brings to the table over Java is raw execution speed. Eiffel compiles, via C, to native code, and in practice that means it has performance comparable to C. Compared to C++, Eiffel is on par speed wise, and uses less memory. Compared to Java, Eiffel is way ahead, both is speed and memory. And you get that sort of performance from a fully OO language complete with generics, garbage collection, and all the other sugar you would expect from a modern OO language.

The downside is that to get that sort of speed Eiffel uses C as an intermediary language, and that means compiling can be very slow. To compensate EiffelStudio has a very intelligent compiler system with so-called "melting ice" technology that means that you only need to recompile as much as was changed since the last compilation. That means that while SmartEiffel is slow to compile, from within EiffelStudio compilation (after initially compiling the project for the first time) is as fast (indeed faster in some cases) as any other compiler I've ever used.

Eiffel has Excellent Concurrency Support

One of the things that Eiffel promises to have in the near future is next generation concurrency support via SCOOP. Instead of implementing concurrency by traditional methods such as monitors, which were introduced by Tony Hoare way back in 1974, SCOOP is based on the CSP model of concurrency that Hoare developed through the 80s as a vast improvement over his monitor model. The result is an incredibly natural and easy to use concurrency system, with much stronger assurances, and amenability to static checking via CSP model checkers (which can verify the impossibility of deadlock, etc.)

How simple is SCOOP? It requires only a single new keyword: separate. The system works by allowing you to declare objects (or classes if every object of that class will always be separate) as being "separate". Objects that are separate may operate concurrently in different threads or processes (SCOOP is agnostic to the actual concurrency mechanism, and is thus also easy to port). Wait conditions are naturally expressed as preconditions on methods. That's essentially all there is to it - almost everything else is handled behind the scenes by the compiler: it just works. If that sounds too easy it's worth reading some of the papers about SCOOP to hammer out the fine details, or just looking at working examples, but in practice it largely is exactly as simple as I just described.

Given that computers are becoming increasingly multi-core, and concurrent programming is becoming increasingly prevalent, having a language with such powerful, yet simple and easy to use concurrency is a huge boon. Getting concurrency right has never been so easy. Unfortunately the full SCOOP system is still being developed. For now SCOOP is available as a library and preprocessor. SCOOP is expected to be integrated into the Eiffel compiler in the next year or so.

Eiffel Helps You Catch Your Mistakes

Eiffel's Design by Contract approach, with pre- and post-conditions is a great way of catching errors earlier by providing both a powerful test harness to isolate errors, and more explicit documentation of APIs. That, however, is just the beginning - once you start providing contracts for your code, you can get other benefits for free. The first major benefit is AutoTest. This is a new system (still being developed, but very functional already) that uses contracts as test oracles for completely automated randomised testing. You push a button and walk away, and AutoTest will fully exercise your code with randomised tests and provide you with a simple report of what went wrong. There's a pluggable system for generating test data, so you can use anything from purely random, to genetic algorithms, to systems designed to provide maximal coverage. And it really does work - AutoTest found several bugs in Eiffel's base libraries that had gone unnoticed for years. There is already an effort underway to integrate AutoTest into EiffelStudio itself.

The other option is ESpec, and in particular ES-Verify which, using a set of modelling libraries, allows Eiffel code to be submitted to automated theorem provers for verification. ESpec is in its infancy at this stage, but already looks impressive, and will hopefully merge with the Extended Static Checking project for EiffelStudio.

Miscellaneous Extras

Both inline agents and non-conforming inheritance are relatively new to Eiffel, and given how powerful and useful they are, they are worth checking out - if you bother to take a closer look at Eiffel be sure to read up on both. Eiffel also offers good multi-platform support: EiffelStudio is available for Windows, Linux, FreeBSD, Solaris, and even VMS (a MacOS X version is forthcoming), and because Eiffel compiles via C you can compile efficient binaries for whatever platform you wish (thanks to gcc). EiffelStudio also, conveniently, comes with an easy to use GUI library, called EiffelVision2, which supports both Windows and GTK+ (and MacOS X in the future). Alternatively you can compile Eiffel to .NET bytecode with EiffelStudio, or Java bytecode with SmartEiffel. In the case of .NET Eiffel is well integrated and you can easily use and inherit from .NET classes. In the case of Java you need an extra wrapper generating tool to use and inherit from Java classes, but it is easy enough to do.

It is also worth mentioning, at this point, that moving to Eiffel doesn't mean discarding an existing codebase. Eiffel has support for using C++ classes via Legacy++, support for wrapping straight C libraries via EWG, the Eiffel Wrapper Generator, can use Java libraries and due to .NET integration it can use C# .NET classes out of the box.

If all of this has piqued your interest, you can start with a quick introduction, a more in depth tutorial, or take a tour of EiffelStudio. It is well worth the look.

Please note that while this article happens to be about Eiffel, there are a lot of interesting languages out there that deserve a second, or in some cases even a first, look. Various other languages that I think are definitely worth the time taking a look at include: Ada, D, Lisp, Nemerle, OCaml, Scala, and Spec#. Seriously, all of those languages deserve a close look to see what they're really capable of, even the ones you may have dismissed in the past.



Link to comment
Share on other sites

I've read the test, but didn't follow the link (since it's 2:15am and I'm drunk) but the main thing that matters to me in a language these days is transactionality. If there's anything Java is doing right, that would be it.

Get a message from a queue, update a database, place a response message on a queue, and if any of this goes wrong, everything gets rolled back. *THAT*'s value in an area that really matters to me.

The other thing would be how different that language is from the other languages. I have never seen Eiffel code, so I can't comment on the inherent qualities of it.

Given the article it seems an interesting language to toy with. But its strengths, and more importantly, weaknesses are unknown to me. And this article won't point them out. Well, not the weaknesses anyways.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...