Eleven - A programming language for building robust, scalable web applications

January 18, 2005

Eleven is a programming language for creating robust, scalable web applications quickly and easily. It offers a 20x programmer productivity increase over traditional server programming languages like ASP, PHP, and JSP by automating state management and taking control of the application's look and feel. From high-level source code with a simple, C-like syntax, the compiler generates complete, ready-to-run implementations in PHP or mod_perl. Applications generated by Eleven maintain their state in a relational database and are inherently fault-tolerant, secure, and scalable.

Does the world really need another programming language?

Yes it does, and here's why.

Frustrated computer userMost interactive web applications today are primitive. Of course there are shining exceptions such as Amazon.com, TurboTax, and others. But by and large, most web applications are crudely designed and not especially reliable. Have you ever entered data into a web application, then lost it due to a browser crash? Have you ever gotten part way through an e-commerce transaction, then had the session go into never-never land while waiting for your credit card to be validated? Have you ever reloaded a web page and found that you just duplicated a transaction by accident? Web applications are server based, so in theory they ought to be as reliable as traditional mainframe applications. But they aren't.

The problem is that there are two ways of creating web applications. There's the expensive way, in which massive amounts of engineering are dedicated to making the sites reliable and scalable. These applications tend to keep most of their state in server-side databases, which run in controlled environments and are carefully managed. If your browser crashes during a session, you can usually log in from another computer and pick up where you left off.

Then there's the cheap way (often seen in corporate intranets and extranets). These tend to keep their state on the client (in hidden form fields or HTTP cookies), in the web server's memory, or in the web server's filesystem. These applications tend to be fragile. They don't handle system failures well, and get confused easily if the user presses the back button, restarts the web browser, etc.

The Eleven project solves this problem by making it quick and easy to create robust, scalable, database-backed web applications. Applications are expressed in a high-level language with a syntax similar to C and a conceptual structure similar to BASIC. Here is a simple example. The code is self-explanatory:

statesafe var first, last;

  print ("Please enter your name.");
  edit ("First name: ", first);
  edit ("Last name: ", last);

  print ("Thank you, ", first, " ", last, ".");
Example 1 screenshot

Here is another example; the world's smallest to-do list application. Where the code invokes the edit function on the table data type, the compiler automatically fills in a table editor:

statesafe table
  var deadline    "Task deadline";
  var description "Task description";
} todolist;

  edit ("Enter your tasks: ", todolist);
Example 2 screenshot

The point is that the Eleven compiler takes over the job of state management. The programmer doesn't need to worry about how the variables first and last are passed from one display to the next, how to represent the to-do list in the relational database, how to deal with the back button, how to enable a session to be seamlessly resumed if the computer crashes, and so on. All of those problems are taken care of automatically.

What's more, those benefits are achieved without any special runtime support. The Eleven compiler translates source code into complete PHP or mod_perl programs that run under the Apache web server. The only runtime support needed is a standard installation of Apache with PHP or mod_perl, and a relational database such as MySQL for the back end. Furthermore, the generated code is fairly readable, and can be inspected before uploading to the web site. This is a great benefit for security-minded system administrators who are wary of installing yet another "framework" onto their production machines.

All applications generated by Eleven automatically save their state to the relational database after every user action. The web browser and web servers are stateless. Thus, the applications have three important characteristics:

  1. They are bulletproof, meaning that the applications are resilient to failures of any runtime component. Sessions cannot be derailed by browser crashes, web server crashes, bookmarking or tampering with URLs, etc. as long as the integrity of the relational database is maintained.

  2. They are secure, meaning that all application data is safely kept private. It is stored in the database, never in hidden form fields or HTTP cookies where it is vulnerable. Consider the example of a web application that is being used from a laptop. If the laptop is stolen, then any private data stored in HTTP cookies is compromised. This is an important factor in medical applications, for example.

  3. They are scalable, meaning that system performance can be increased by replicating the application across a load-balancing server farm. HTTP requests can be directed to random web servers even within a single user session, and the applications will still work reliably. The only performance bottleneck is the database, and there are existing commercial solutions for scaling databases.

We introduce the term statesafe to describe web applications that achieve these three benefits using this architecture. All web applications generated by the Eleven compiler are statesafe.

Development roadmap

The ultimate goal of this project is to be able to express complex web applications in the Eleven language, then have the compiler automatically generate statesafe implementations. The bulk of the development roadmap consists of making the Eleven language more expressive and powerful.

Planned language features

Planned runtime features

How to get started

Marshall amplifierEleven is available for download from SourceForge and is distributed under the terms of the General Public License.

The current implementation of Eleven has been tested on Fedora Core 2 Linux, with a single-host Apache installation and the MySQL database. The software has also been successfully installed on Debian Unstable (x86) and Mac OS X. Applications generated by Eleven should work with other databases, should run on any Apache installation, and should work in a multi-host load balancing server environment. If you experiment with Eleven, we would very much like to hear about your experience. Please send porting experiences, questions, bug reports, feature requests, or other comments to Joe Morrison at jdm@statesafe.org or post them to the mailing list.

What does the name mean?

The name Eleven alludes to the language's focus on scalability. In the movie This is Spinal Tap, guitar player Nigel Tufnel points out to director Marty DiBergi that the settings on his Marshall guitar amplifiers all go up to eleven:

"You see, most blokes will be playing at 10. You're on 10, all the way up, all the way up... Where can you go from there? Nowhere. What we do, is if we need that extra push over the cliff, you know what we do? We put it up to 11. One louder."

SourceForge.net Logo Valid XHTML 1.0!