Basics of creating algorithms

In this section, the basic principles of developing an algorithm with the 'electroNeek' platform are considered

Introduction

To develop an algorithm, the 'electroNeek DevTool' program should be opened. The 'electroNeek Agent' program is run automatically while 'electroNeek DevTool' is opening. The 'electroNeek Agent' tool is used to execute the algorithm developed by the user.

From this point on short names of 'DevTool' and 'Agent' will be used to refer to 'electroNeek DevTool' and 'electroNeek Agent' accordingly.

Interface

The picture below shows the interface of the 'DevTool' application.

The 'DevTool' application interface look

The numbers on the picture represent the following:

  1. A group of buttons to save, open, or create a new file with an algorithm.

  2. A block with functions, grouped by the function they automate.

  3. A button to launch the algorithm. When the algorithm is running, the stop button will be displayed nearby.

  4. A path to the opened algorithm (if a user creates a new algorithm and doesn't save it then the 'New file' phrase will be shown as on the picture above).

  5. Left-to-right: the current account information, the platform logo (the documentation is opened after clicking the logo).

  6. The selected function's properties: its description and parameters

  7. A block with variables where all variables initialized in the current algorithm are shown.

  8. A console where messages about the robot status are shown.

  9. The workspace where functions can be added and connected.

Algorithm

The so-called 'Visual programming' is used to create an algorithm. A user adds functions to the workspace which are shown as blocks. Each block contains parameters to set according to the business process.

With JavaScript expressions it is possible to make the algorithm more functional and flexible. In particular, the 'Execute js code' function can be used to store some JavaScript algorithm.

All variables (apart from those that were created inside the 'Execute js code' block) are global and saved in the current account. This means all these variables are accessible from any '.neek' file and any block.

If a user created a variable inside the 'Execute js code' then outside this block that variable will not be accessible.

Block

To add a block to the workspace, a user needs to double-click the corresponding name from the left panel or drag and drop the block directly to the workspace.

Clicking on the block will activate the 'Block properties' tab where the parameters are displayed and can be set. All required parameters are marked with a red star. Each block has the 'Comment' field. This allows to give a description to the block's function so it will be easier to understand the role of the function in the process.

The 'Send email' function parameters

If a block is highlighted with green, then all the required parameters are set. If the block is highlighted with yellow, then some of the required parameters are not set.

Each block contains at least two ports (ways to follow the algorithm). The branch coming out of the green port corresponds to successful execution of the current block. The branch coming out of the red 'Error' port is used when an exception has occurred during execution of the current block. Logical blocks contain three ports: 'Yes', 'No' and 'Error'.

Blocks can be moved, copied or deleted. It is possible to select multiple blocks holding the 'Ctrl' button and making a left-click on the desired blocks. Multiple blocks can be moved, deleted, copied, and pasted simultaneously.

Tips

While developing an algorithm, it is recommended to stick to the following practices:

  1. Split one large program into small subprograms based on the logic and goals of the process. This will help to see the algorithm's structure better, understand its idea easier, and make changes faster.

  2. Try making an algorithm neat and readable. Delete all blocks that were used to debug and have no practical value. Comment blocks and make use of the 'TODO' function. This is useful if several developers are working on the project as descriptive comments will help to understand the code better and faster.

  3. Give readable names to variables and subprograms that clearly reflect its purpose. There are some widely used notations (as shown in the table below) and it is recommended to stick to a single standard.

Notation

Example

Camel

ListOfContragents

Snake

list_of_contragents

Hungary

arrListOfContragents