Electric Communities: E Programming Language  Contents  Home Page

Getting Started

This chapter discusses the following topics:

How to install and set up E
E syntax and terminology
General principles for programming E applications

How to install and set up E

You can download the E extensions from the Electric Communities website, http://www.communities.com. For installation and configuration instructions, see the online README.TXT file. For information on last minute updates to E, see the online RELEASE.TXT file. All the documentation for the E extensions (including this tutorial) is also available online, both in HTML and postscript format.

E syntax and terminology

This section describes basic E syntax and terminology, including the following concepts:

For more detailed information on these concepts, see the Glossary, and also the E Programmer's Manual.

In E, objects send messages to other objects, either on the same or on a remote machine. As you would send a message to a friend across town or across the country, and have a reasonable expectation that your friend would be the person to receive it (instead of their entire neighborhood), so E-objects send specific messages to each other. An E-object can be any of three things:

E-classes receive a given message by using E-methods. An E-method is a block of code invoked when the E-object receives a message of the given E-method name. E-methods never return values because of the nature of E. The only ways to receive a requested value is through channels and distributors, and through deferring statements such as ewhen and eif ( mentioned in the following paragraphs).

You define an E-method using the keyword emethod. Unlike a Java method, an E-method creates a private void method, and is not directly accessible with normal Java programming techniques.

To send a message, you use the send operator, which is the left arrow symbol (<-). In Java, you call a method and wait until a message arrives. In E, you send your message and forget about it, assuming that the message will arrive and be acted upon.

The ewhen and eif statements defer execution of their associated code block until a value has been furnished for an expression. You use ewhen and eif to enforce security, to obtain values from other E-objects, and to bind Java and E. As you go through the tutorials, you'll see how this is done.

If you want to send a message to a distributor (for example, in order to send it a forward message) you use the distributor operator, which is the ampersand (&). This operator lets you interact with the distributor as an E-class.

General principles for programming E applications

You'll find these guidelines repeated in more detail in the E Programmer's Manual,, but they are important concepts to remember when programming in E and are worth reviewing here. If you are already comfortable with the concept of writing code with optimistic computation in mind, you can skip this section.

  1. Write your code as if you already have the answers. This means writing your code as if you already have all the values you need for computation.
  2. Create message protocols that deliver the values you need. Set up channels (usually unforwarded at this stage) and distributors to move this information when it becomes available. This code goes at the beginning.
  3. Write ewhen and eif statements for each value that you assumed you had in step 1. These statements follow the protocols and encompasses the body of code you wrote in step 1. They enforce security by insuring that the code which uses a value you assumed does not get executed until after it actually gets that value.
  4. For each value for which you initially provided an unforwarded channel, write a forward statement that will deliver the value at the time you specify.

Copyright (c) 1996 Electric Communities. All rights reserved worldwide.
Most recent update: 6/24/96