Skip to main content

Preparing to build an algorithm


Before starting work on building an algorithm, first we need to organize the business data that we have at our disposal.

Determination of the input and output data of the algorithm​

When building an algorithm, it is necessary to verify what data will be transferred into it and what data the algorithm will return. The algorithm's data structure should be built on the basis of this data. When creating the data structure, you should define what data types each field may to be filled in with (number, date, text, dictionary field) and whether individual records or lists may be transferred within the structure. We often design a set of algorithms - such sets can be based on one or more common data structures. This decision should be made at the design stage - the use of common structures for a group of algorithms will enable:

  1. easy calling of one algorithm from another (convenient construction of sub-algorithms),
  2. easy calling of any algorithm of the group from an external system / component (because each algorithm will be based on the same structure of input and output data).

Definition of dictionary data for the algorithm​

When building an algorithm, it often happens that some of the data transmitted or returned by the algorithm is in a fixed, dictionary form. It is a good practice to use a dictionary for such fields, which will organize and limit the values of the fields with which the algorithm works.

Determining which configuration tables the algorithm will use​

Arranging and storing the data set in tabular form makes it easier to build the algorithm, allowing you to minimize the number of logical conditions in the algorithm itself.

In order to build the table correctly, specify:

  1. what type of data it will store,
  2. what sets of keys will lead to this data.

As part of the analysis, it is necessary to verify how the created algorithm will use the table (so that the data present in the algorithm matches the dimensions of the table).

Thanks to decision tables, you can create tables that look analogous to tables built with tools such as Word or Excel.

tip

The best way to create a table is to base it on a table that looks similar to the one provided as part of your business requirements. Thanks to this, it will be possible to directly transfer the values from the provided documentation to your table and it will be harder to make a mistake when building the table itself.

For more information on how to create a table and configure it, see: Creating a new table.

Determining what steps the algorithm will consist of​

The first element of the algorithm’s implementation is the analysis of the steps it will consist of. It is necessary to consider what effect we expect from the algorithm. It is best to create a chart, graph or list of individual elements on paper, in which we divide the algorithm into individual steps to be performed. You can also draw the algorithm as simple graphic blocks and use arrows to mark the transitions between them to indicate the sequence of individual steps. We recommend all kinds of tools for creating block diagrams - when transferring from the business model to archITekt, they significantly facilitate the work and allow you to avoid problems at the design stage.

tip

The algorithms, created on the basis of a diagram written on a piece of paper or from a graphic tool, give a more accurate, more detailed representation of the ideas presented in these tools. Therefore, the algorithm will look similar, and will consist of more details.

With more complex algorithms, you should consider separating some of their parts that can be reused by other algorithms (you can use them in the unchanged form at least several times) and create so-called sub-models (sub-algorithms). Thanks to this approach, it will be easier to make changes in the future and use sub-algorithms in new algorithms, which will significantly reduce the time of their generation. The use of sub-algorithms also has the advantage that it simplifies the view of a complicated algorithm by dividing it into individual functional blocks.

See also​

Decision tables

Algorithms

Algorithm testing