Summary: Activity blocks can be built up from other blocks, simply by dragging them into a block and connecting them.
A building block can be composed from other building blocks from libraries or your own projects. In contrast to programming approach, with Reactive Blocks developers reuse not only code, but also the activity diagram describing the behavior of this block and its corresponding block contract.
In order to compose building blocks, first you need to instantiate them and then wire them by connecting their pins with control or object flows.
To instantiate a building block, you can drag the block from the Blocks view to the activity diagram on the behavior page of the Blocks Editor as illustrated with an arrow labelled with (1) in the figure below.
In the Blocks Editor then you will get a blue block (2) with pins on its edges.
The block is an instance that refers to the actual building block. You can consider a block instance and its referred block like an object and its class in the object-oriented concept. Double-click a block instance to view its full specification. However, looking at its full specification is NOT necessary to use a block. Since it is an instance, any modification should be done on the actual specification of the building block. This means that you cannot, for example, add or delete pins (see the next section) on a block instance.
A reactive block is a software module that usually encapsulates more details then you need to know when using this block. The usage of a block depends on understanding its contract and connecting its pins appropriately.
From the context menu of a block instance, you can:
Executing action “Match with Original Block” means that the instance is synchronized with its corresponding specification. This action needs to be taken when the original specification is changed.
The pins on a block instance are used to connect the block with other modeling elements.
You will often see several different types of pin. These are just intended to help you use the block instance. Sometimes, the name of the pin gives you a good idea on how to compose the instance.
An example of a block instance with its pins is depicted in the figure below:
All types of pins can be used with all types of flows. So no matter if a pin is a starting or terminating or streaming pin, it can be connected using a control or an object flow. Note that you do not need to use all pins. There may be for example an output streaming pin which provides data you are not interested in. In that case you may leave this pin disconnected.
You can move a pin along an edge with the arrow keys. The orientation of a pin can be changed with key “r” for rotate or from the context menu.
In order to use a block instance correctly, you need to understand its behavior interface contract as described here.