DiagramElements-Connection/en

Aus expecco Wiki (Version 2.x)
(Weitergeleitet von DiagramElements-Connection)
Zur Navigation springen Zur Suche springen

Introduction[Bearbeiten]

A connection is used to interconnect two pins in an activity diagram. Depending on the type of the pins, the connection models either a data flow- or a control flow-connection.

Connection between Steps
Connection from Action's Input to a Step
Connection from a Step to an Action's Output
A Hidden Connection
A Hidden Connection when Mouse is Over

Input pins can only be connected with output pins (1) and the datatypes of the pins must be compatible. That means they either have the same type or the input pin has a "more general" type than the output pin;
e.g., for numeric types, Number is more general than both Integer or Float. Inputs with an "Any" datatype are most general and can consume any value.

Outputs can be connected to multiple input pins, but each individual connection consists of exactly one input and one output pin. If an output pin has more than one connection, an outgoing value is sent to all connected inputs (concrete: a reference to the same datum-object is sent to all inputs). Thus, you should be careful with data object which contain state, and are mutated (modified) by an action. If that is the case, you should ensure proper synchronization to avoid time/execution order dependencies during execution (e.g. with control flow connections between trigger-in/trigger-out pins).

Notes:
1) For your convenience, the diagram editor will let you drag connections between two inputs:

- if the first input is frozen to a constant value or a variable. Then, the target input will be frozen to the same value or variable.
- if it is connected to another pin, then a connection to the same output will be created.

Controlling a Connection's Look[Bearbeiten]

Click on a connection to select it and choose an appropriate item from the right-button menu.

The toolbar also contains buttons for frequently needed operations on connections, and to change the defaults for future connections.

Suppressing the Type Check[Bearbeiten]

In some situations, expecco considers pins incompatible, although in reality they are not. This happens, when an output has been over-generalized (for example as "Any" or "Number") and needs to be connected to a less general input pin (for example "String" or "Integer").

In such situations, expecco assumes that the output may generate values which cannot be consumed correctly by the input. However, expecco does not look into the actual code inside elementary blocks, and the code may actually accept the value.

If you are sure, that only correct values will be generated at the output pin, you can enforce a connection (against expecco's resistance, if you like), by pressing the CTRL-key while dragging the connection in the editor. The editor will then create the connection, but draw it as a dotted line, to indicate a possible type conflict at execution time. This can be changed to a solid line via the "Disable Type Check" context menu item.

Guidelines for Pin-Type Declarations[Bearbeiten]

In general, it is a good strategy to declare the type of output pins as specific as possible, and input pins as general as possible. For example, an input that can deal with any collection should have a type "Collection", even if it will only deal with Strings in your setup. An output should be typed as String, if it produces strings, not as Any. In general, avoid "Any"-typed outputs (see "Any_Type_Considered_Harmful").

See also[Bearbeiten]

Pin Step



Copyright © 2014-2024 eXept Software AG