Each application has business logic, a flow of actions, and operations through which the app’s functionality is reflected.
Business processes are a big part of business logic. This article will review what a business process is and how to create it.
What is business logic?
Before considering business processes separately, let’s analyze the concept of business logic.
Business logic is a piece of software that consists of processes that determine the sequences of actions and operations in the application and set the rules for interaction between the user and the system.
Let’s look at the business logic through a simple example of a passenger check-in for a flight by an administrator who enters information into the database.
The administrator selects the flight and fills in the passenger check-in form by entering the necessary data. At this time, the system checks whether the user is authorized and has the right to perform these actions. Then the program processes the information received, checks the data for compliance with the established format, receives data from the database about the flight and the passenger, notifies if the information is incorrect, sends the data to the database with the command to make changes.
As a result, the data is updated, and a new passenger appears in the list.
The actions described in the example, their sequence, data exchange, processing, requests, and responses are the responsibility of the business logic.
Business logic is an integral component of the application architecture. The logic itself consists of business processes, which we will discuss next.
What is a business process?
Business processes are a sequence of actions. Through these actions, we implement the application functions.
Business processes in AppMaster.io
As with the classical approach, in AppMaster.io business logic is built from business processes. BPs are designed to work with data: searching, creating, deleting, updating, changing; and are responsible for performing any actions in the application.
The platform has a business processes editor for working with business logic. Blocks are used to create BP.
In each business process, Start and End blocks are created automatically. They can have variables: input for the start block and output for the end.
Each BP block, except for the start and end blocks, has two types of connectors — connection points (input, output):
- flow_connection — execution flow connector, describes the queue of blocks, which one to execute;
- var_connection — variable connector, describes which variable to take from where.
Business processes are divided into three categories:
- Back-end business processes — compiled into Go source code and executed in a server application.
- Business processes for mobile applications are delivered to mobile applications and executed in them, processed by native tools of mobile platforms.
Within each type of application, there is a specific set of business processes.
In the backend, there are ordinary business processes. They have Start and End blocks. Can support asynchronous call and transaction mode.
There are the following types of BP in web and mobile applications:
- Component BPs are set in each component, page, widget, or screen. They depend on the component for which they are created. They do not have an End block. They have one or more trigger blocks at the input that start execution when a given event occurs; for example, a button is pressed.
- Application-level BPs — set for the entire application, almost identical to component BPs, except they have an application context and have only one trigger block — the initial one.
- Generic BPs are set at the application level, but they are designed to take out frequently used logic from all other business processes. These BPs have Start and End blocks and behave similarly to server business processes but do not have a transaction mode.
How to create a business process on AppMaster.io?
There is a business process editor to work with business processes on the AppMaster.io platform.
All the editors are built based on the same principle and have only a few differences depending on the type of business process (we mentioned BP categories earlier).
The BP editor consists of:
- left panel with a list of available blocks;
- canvas in the center;
- right panel with the settings of the selected element (block).
To add a business process block, you need to drag an element from the left panel to the workspace.
In the settings of each BP, you can activate the transaction mode. In this case, the BP acquires the property of atomicity: the BP is either executed completely, or none of its individual blocks are executed. If an error occurs in any block, then all changes caused by previous blocks of the business process will be rolled back.
On the left panel, the blocks are divided into groups by types:
- Logic. Responsible for changing the process flow, implementing system functions, comparing variables, and converting data types.
- Functions. Allows you to perform various types of operations on different types of data, such as rounding numbers, splitting strings, reading files, and more.
- Model Functions. Allows you to perform operations on data models such as creating, searching, editing, and deleting.
- User-Created BPs. Calls any of the custom workflows you have created.
- Variables. Sets and saves the variables to be used in the business process.
- External API Requests. Launch any previously created request to an external API.
- Models. Set and save data model variables to be used in the business process.
- Enums. Sets and saves enumerator variables to be used in the business process.
- Auth. Blocks added by the Auth authorization module.
When adding a module to the project, there will be automatically created a separate section in the list of blocks with the business processes related to this module.
Variables can be set in the right panel. To add variables, select the desired business process block and click the plus icon (+) on the Variables panel.
There are local and global variables.
Local variables are available for all types of business processes. Local variables exist within one BP. After the execution of the BP, local variables are destroyed, freeing up the application’s RAM.
Global variables are intended to be used throughout the application. They are declared in advance and are available in any business process. They store data during the life cycle of the application — while it is running.
Local and global variables can be of any type: from simple int and string to arrays of models and enums. Stored exclusively in RAM.
Business process example
Let’s create a small business process following the example we described earlier: checking in a passenger for a flight.
*All data has already been entered into the database. The following describes only the creation of a business process. The full lesson is available here.
Go to the Business Logic section and click on Create business process to create a new process.
In a new window, enter the name of the process, fill in the description field and enable the transaction mode if necessary.
By default, our BP already has two blocks: Start and End.
We add a few variables as input to the start block. To do this, click on the desired block, and on the right side of the screen opposite Variables, click the + icon.
Enter the name of the variable, specify its type, and set the default value if necessary.
We add a few variables that we need to check in a passenger for a flight:
Next, we need to get the flight ID from the database. To do this, we add a GetOne Flight block.
We establish connections between the blocks. For this, it is enough to stretch the arrow from one block to another. Here, the blue line functions as a flow connector between blocks, indicating the order in which they are executed. Colored lines are data connectors established between variables and indicate where to get and where to transfer data within the BP.
The flight ID is received. We need to get the passenger data and make sure that such a person is in the database.
Add the Expand Passenger block and get the passenger ID. Using the GetOne Passenger block, we check his record in the database.
Now we need to create the registration itself. To do this, we use the Make Registration block and create connections between blocks.
Now we need to save the registration record in the database because before we only created it as part of a business process. We add the Create Registration block, make connections, and complete the business process.
Our BP presents the following flow of actions:
- searching for flight data in the database;
- getting a passenger ID;
- creating and saving a registration record.
The video tutorial provides a step-by-step analysis of creating a business process, as well as an overview of the Business Logic section on the AppMaster.io platform. And on the YouTube channel, you can take the full AppMaster.io 101 course and learn how to work with the no-code platform.
That is how easily, with the help of visual blocks and drag & drop builder on the AppMaster.io platform, you can create business processes of any complexity. You can always register for the trial period on the platform and create your first business process and maybe application.