Difference between revisions of "Tutorial tour"
Line 19: | Line 19: | ||
|- |
|- |
||
|<code>HELLO_WORLD</code> |
|<code>HELLO_WORLD</code> |
||
− | |the class of which an object is created (you may also write it in lower-case, or use its filename with the <code>.e</code> extension) |
+ | |the class of which an object is created (you may also write it in lower-case, or use its filename with the <code>.e</code> extension) we call it root class, as this is the root of the programs object tree |
|- |
|- |
||
|<code>make</code> |
|<code>make</code> |
||
Line 30: | Line 30: | ||
The command produces an executable, usually <code>hello</code> or <code>hello.exe</code> depending on the system. After compiling is finished, you can run the executable. |
The command produces an executable, usually <code>hello</code> or <code>hello.exe</code> depending on the system. After compiling is finished, you can run the executable. |
||
− | This unavoidable program is in <code>hello_world.e</code> and lets you grasp the basic concepts of Eiffel. Those concepts are: |
+ | This unavoidable program is in the file <code>hello_world.e</code> and lets you grasp the basic concepts of Eiffel. Those concepts are: |
* '''Everything is a class'''. In Eiffel, outside classes there is no salvation. |
* '''Everything is a class'''. In Eiffel, outside classes there is no salvation. |
||
− | * The program starts by '''creating an object''' |
+ | * The program starts by '''creating an object''' (of the root class) and initializing it by execution of the given root creation procedure. Here, the <code>make</code> feature in the class <code>HELLO_WORLD</code>. |
* Each file is named after the name of the class it contains, in lower-case, with the <code>.e</code> extension. |
* Each file is named after the name of the class it contains, in lower-case, with the <code>.e</code> extension. |
||
+ | * Each class comes with a set of '''features''', all its attributes and methods which come in form of functions (if they return a result) or procedures (in case they just 'do' something) |
||
* Note the special object <code>io</code> that allows you to write text on the standard output. We will see that it also lets you read data. |
* Note the special object <code>io</code> that allows you to write text on the standard output. We will see that it also lets you read data. |
||
* For the Eiffel syntax, look [[Syntax_diagrams|here]]. |
* For the Eiffel syntax, look [[Syntax_diagrams|here]]. |
||
+ | Please take a look at the following examples in the tutorial folder to see some classical example programs (some of them are in organized in folders for better overview) |
||
− | See also: |
||
* fibonacci.e |
* fibonacci.e |
||
* knight.e |
* knight.e |
||
Line 46: | Line 47: | ||
* triangle |
* triangle |
||
− | To compile the other samples you must modify the compiler command. |
+ | To compile the other samples you must obviously modify the compiler command to give another root class . |
== Some important concepts == |
== Some important concepts == |
Revision as of 20:52, 16 February 2016
Welcome to the guided tour of the tutorial!
All the classes in the tutorial are provided with your LibertyEiffel installation, in the tutorial
directory.
Easy starting: Hello World!
To compile the program, go to the LibertyEiffel/tutorial
directory and execute the command:
se c HELLO_WORLD make -o hello
The meaning of the command is
se
|
the front-end tool for the LibertyEiffel compiler |
c
|
the tool invoked by se for compile into an executable
|
HELLO_WORLD
|
the class of which an object is created (you may also write it in lower-case, or use its filename with the .e extension) we call it root class, as this is the root of the programs object tree
|
make
|
the creation procedure of the HELLO_WORLD class to call
|
-o hello
|
generates an executable with the name hello (linux) or hello.exe (windows) |
The command produces an executable, usually hello
or hello.exe
depending on the system. After compiling is finished, you can run the executable.
This unavoidable program is in the file hello_world.e
and lets you grasp the basic concepts of Eiffel. Those concepts are:
- Everything is a class. In Eiffel, outside classes there is no salvation.
- The program starts by creating an object (of the root class) and initializing it by execution of the given root creation procedure. Here, the
make
feature in the classHELLO_WORLD
. - Each file is named after the name of the class it contains, in lower-case, with the
.e
extension. - Each class comes with a set of features, all its attributes and methods which come in form of functions (if they return a result) or procedures (in case they just 'do' something)
- Note the special object
io
that allows you to write text on the standard output. We will see that it also lets you read data. - For the Eiffel syntax, look here.
Please take a look at the following examples in the tutorial folder to see some classical example programs (some of them are in organized in folders for better overview)
- fibonacci.e
- knight.e
- pyramide.e and pyramide2.e
- gcd
- hanoi
- parking
- triangle
To compile the other samples you must obviously modify the compiler command to give another root class .
Some important concepts
ACE files
Input-output
- io
- directory
- basic_directory?
Arguments
print_arguments.e
Collections
including iterator and sorting
Manifest notations
manifest_notation.e
Downcasting
downcasting.e
To go further
Agents
... and tuples
external
cecil
Memory management
memory
Extension libraries
Random
Date & time
Storable
Sequencer
Vision
visiopn, signal