Rules

There are rules to how the codes and the information they contain can be sequenced, acquired and replaced. These rules are known as hierarchy, referencing and overwriting.


Hierarchy in Coding

Hierarchy exists in a flowchart, determined by the sequence of its nodes and procedures. It is closely related with the concept of dependency whereby the information downstream depends on the information passed down from upstream. Hence, information has to be defined upstream first, before a downstream procedure can reference or overwrite the information.

(Left) Node 2 is dependent on Node 1<br>(Right) Polylines pl1 and pl2 are dependent on positions p1, p2 and p3, p4 respectively <br>collection col1 is dependent on pl1 and p2
Figure: (Left) Node 2 is dependent on Node 1
(Right) Polylines pl1 and pl2 are dependent on positions p1, p2 and p3, p4 respectively
collection col1 is dependent on pl1 and p2
Upstream

If element A is upstream in reference to element B, element A lies above element B in the procedure.

If node A is upstream in reference to node B, node A lies above node B in the flowchart.


Downstream

If element A is downstream in reference to element B, element A lies below element B in the procedure.

If node A is downstream in reference to node B, node A lies below node B in the flowchart.



Referencing

Referencing refers to accessing data that are created upstream in the same or previous nodes.


Referencing Within the Same Node

To access data created by upstream procedures in the same node, users can reference by its variables or attributes.

In the case of referencing by its attributes, users can

See Referencing Entity Attributes and Global Attributes

See Referencing Default Attributes


Referencing Across Nodes
Nodes Connected in Series

To access data created by upstream nodes that are in series with the current node, users can reference by its attributes.

In the case of referencing by its attributes, users can


Nodes Connected in Parallel

Users cannot acquare data from an node connected in parallel with the current node.



Overwriting

In programming, overwriting is the process of new values replacing old values when:

  1. A variable created downstream in the node shares the same name as a variable upstream.
  2. A modify function is used on a variable.

Overwriting helps users update variables and the values they contain; however bugs may occur when the users unintentionally overwrite older codes that he/she intends to keep. When this happens, there will be errors causing incorrect or unexpected results. Hence, if a user does not intend to overwrite, he/she should:

  1. Name a new variable differently from the variables upstream.
  2. Make a copy of the variable that he/she intends to keep, before using the copy as an argument input for the modify function.

See Common Misconceptions and Workflow: Hierarchy and Overwriting

results matching ""

    No results matching ""