Skip to main content

EXAMPLE: App Architecture

In the microflow typology example, the junior developer Jasmira did not take the app architecture into account while structuring the unit microflows into orchestrations. She just grouped functionality into orchestrations if they are tightly bound.

In this extended example, we take the microflow typology example and take some architectural principles into account.

1. The Existing Microflow Structure

The microflow call hierarchy created by Jasmira in the typology example has the following structure:

image-20251124-135540.png

2. Dependency Injection

The structure shows that the microflow ORC_ordr_set_amount is retrieving the Order by the OrderLine (marked red) as part of the orchestration.

image-20251124-135837.png

image-20251117-151514.png

To eliminate the dependency, move the call to GET_M_ordr_by_olne from the ORC_ordr_set_amount to the parent ORC_olne_set_quantity_and_amount and pass the retrieved Order to the input parameter ORDR of ORC_ordr_set_amount.

This step enhances re-usability and improves component testing because the OPR can now be used independently of OrderLine manipulation.

3. Private & public microflows

Let’s review the microflow ORC_olne_set_quantity_and_amount.

image-20251118-101324.png

The orchestration contains unit calls that use the output of previous unit calls. This is the case for the following microflows:

  • OPR_olne_set_quantity uses results of FTN_date_calculate_yearfraction
  • FTN_decimal_multiply uses results of OPR_olne_set_quantity (see picture above)
  • OPR_olne_set_amount uses results of OPR_olne_set_amount

This means that these microflows are probably dependent and could not be reused straight away. Note that this is the case for both OPR microflows, but that the FTN microflow still is independent.

A proper way to indicate that a microflow is dependent is to make it private and encapsulate it in a separate orchestration.

Evaluating OPR_olne_set_quantity

Jasmira added the underscore prefix to the microflow OPR_olne_set_quantity to make it private and encapsulates it with the FTN_date_calculate_yearfraction into an orchestration microflow ORC_olne_set_quantity.

image-20251117-162552.png

Evaluating OPR_olne_set_amount

Jasmira takes the same action for this microflow and created the orchestration ORC_olne_set_amount with a private call to the operator.

image-20251117-162842.png

Evaluating the new ORC_olne_set_amount

Now the functions are encapsulated into two orchestrations, Jasmira still has the issue that the ORC_olne_set_amount itself is dependent on the ORC_olne_set quantity orchestration.

So both orchestrations are made private and are wrapped in the ORC_olne_set_quantity_and_amount.

image-20251118-102408.png

warning

Note that while the decomposition into many separate orchestrations demonstrates microflow layering, this may be excessive for typical applications. In production, tightly coupled operations should usually be grouped into a single orchestration to reduce the number of redundant wrapper microflows. However, the example shows a full decomposition for demonstrative purposes only.

Furthermore, the use of ORC_olne_set_quantity_and_amount as a wrapper microflow is redundant. This microflow now can be eliminated, allowing ORC_olne_save to directly invoke the private orchestrations.

4. The resulting microflow hierarchy

The microflow structure now looks like this (private microflows are marked red):

image-20251124-140607.png

5. Splitting the microflows into horizontal layers

Jasmira moves the ACT_olne_newedit_save to the Touchpoint layer. She then put the ORC_olne_save, CMT_olne_save into the App Logic Layer. Finally She put all OPR, GET, FTN and VAL microflows into the Domain Layer.

info

Generic functions normally go into a ‘utility’ module.

The ORC_olne_set_quantity_and_amount microflow including the sub orchestrations is placed in the ‘Domain’ folder as well, because this microflow functions as a ‘public interface’ to recalculate the OrderLine and associated Order. In summary:

5.1. Touchpoint layer

ACT_olne_newedit_save

5.2. App Logic Layer

Committers

CMT_olne_save

Orchestrations

ORC_olne_save

5.3. Domain Layer

Getters

GET_M_ordr_by_olne
GET_M_ordr_amount_from_olnes

Functions

FTN_date_calculate_yearfraction
FTN_decimal_multiply

Operations (Private)

_OPR_olne_set_quantity
_OPR_olne_set_amount

Orchestrations (Public)

ORC_olne_set_quantity_and_amount
ORC_ordr_set_amount

Orchestrations (Private)

_ORC_olne_set_quantity
_ORC_olne_set_amount

Validations

VAL_ORC_olne_save
VAL_olne_mandatory_associations
VAL_olne_mandatory_attributes
VAL_olne_save_start_before_end
VAL_ordr_save_amount_ok