Using Blocks

Summary: Activity blocks can be built up from other blocks, simply by dragging them into a block and connecting them.

Connecting Building Blocks

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.

Instantiating Blocks

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:

  • See a brief information about the block from action “Show info…“,
  • Open the block’s contract from action “Show Contract”,
  • Refer to another block from action “Set Building Block…“,
  • Set instance parameters and generics if the block specifies any from action “Parameters and Generics”.

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:

  • Starting and terminating pins indicate start and termination of a block respectively. These pins have white background. They are used to control the life cycle of a block instance.
  • Streaming input and output are used to interact with a block when it is active. These pins have black background.
  • Double frame around white pins indicate alternatives. It is usually used by terminating pins. There are alternative starting pins too, however they are much seldom.

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.

The Interface Contract of a Block Instance

In order to use a block instance correctly, you need to understand its behavior interface contract as described here.

Use the analyzer and animator tools to check whether the block instance is correctly integrated into an enclosing block.