x = 1;
y = 2;
Java is an imperative programming language, where the sequence of steps you write dictates to the compiler in what order the code has to be executed. In the example, x = 1 is executed first, y = 2 next, and then System.out.println. Here, the programmer controls the sequence and state.
For the same code, in ECL you would:
x:= 1; //An attribute declaration
output(x+y); //An action
The code looks similar to the Java code. The difference is that the steps x := 1 and y := 2 do not perform a state assignment operation nor do they define the control flow. It simply means, when there is a need to use x, substitute the value 1. Until there is a need, do not do anything.
Well, you might now ask the question - Is being a declarative programming language really important?
The answer is "YES". In parallel computing, it is best left to the platform to determine the optimal sequence (or parallel) steps to execute to reach an end goal. Performance and scale is everything.
Attributes and Actions
- Attribute (aka Definition): A declaration such as x := 1; is representative of an attribute declaration where x is an attribute. It is important to note that an attribute is not equivalent to a variable state assignment, but rather a declaration. The difference is that a declaration, postpones the evaluation until the attribute is actually used.
- Action: An action such as output(x+y); instructs the platform to execute a code snippet that would be expected to produce a result.