Propagation rules
Propagation rules are the rules that describe how a change of the mark of a component in the dependency graph will affect status of other components in the dependency graph this component interacts with. For example, if a class in an object-oriented system was changed (i.e. assigned a status Changed), then all the classes that either use or are used by this class should be inspected for a possible change (i.e. assigned Next status) as well. Propagation rules help to ensure that changes to software are done in a consistent and correct way.
All propagation rules work in the following way:
- Encounter a new mark of the current node and analyze whether it is applicable concerning the current mark of the node. A mark can be replaced only with a mark that has a higher priority.
- If the new mark is applicable, assign it to the node.
- If the node was assigned a new mark, select a granularity at which the effect of the mark change should be estimated. It is possible to select either the same, the coarser (i.e., parents) or finer (i.e., members) granularity.
- Find all neighbors of the node at the selected granularity. Also, decide what mark should be applied to the neighbors taking into account the new mark of the current component.
- Analyze the current mark of each of found nodes to find out if the decided mark is applicable to the node.
- If the decided mark is applicable, assign it to the neighbors.
- Propagate marks between components and their members. The new mark of the parent is given to all children that have a mark of a lower priority than this new mark. When switching to a coarser granularity, the highest-priority mark of all children becomes the mark of the parent.
Therefore, current mark of the node, new mark, decided mark, selected granularity, and dependencies are the main factors taken into account by the propagation rules. Following is the list of the propagation rules, that can be applied depending on the current mark of the node.
- Located or Impacted or Changed
- Located or Impacted or Changed propagation rule can be applied to a node with this mark. Leaves the current mark of the node as is (as the new mark is similar to the current mark) and, except for the case of Located mark, assigns Next mark (when applicable) to the neighbors of the current at selected granularity.
- Propagating
- Propagating propagation rule can be applied to a node with this mark. Leaves the current mark of the node as is (as the new mark is similar to the current mark) and assigns Next mark (if applicable) to every neighbor of the current node at selected granularity.
- Located or Impacted or Changed propagation rule can be applied to a node with this mark. Changes the current mark of the node to the new one and, except for the case of Located mark, assigns Next mark (if applicable) to every neighbor of the current node at selected granularity.
- Next Visit
- Located or Impacted or Changed propagation rule can be applied to a node with this mark. Changes the current mark of the node to the new one and, except for the case of Located mark, assigns Next mark (if applicable) to every neighbor of the current node at selected granularity.
- Propagating propagation rule can be applied to a node with this mark. Leaves the current mark of the node as is (as the new mark is similar to the current mark) and assigns Next mark (if applicable) to every neighbor of the current node at selected granularity.
- Visited propagation rule can be applied to a node with this mark. Changes the current mark of the node to the new one. Has no effect on the nodes the current node interacts with.
- Visited
- No new propagation rules can be applied to a node with this mark.
- Blank
- No propagation rules can be applied to a node with this mark (see Stage of Incremental Change for more details).
There is also a relaxed version of this rules, which treats nodes, marked as Blank , in the same way as if they were marked as Next. To read more about this, please go to the Incremental Change Modules section.
The behavior of propagation rules depends on the selected granularity of analysis, see [1] for more details.
JRipples dependency graph supports components of any level of nesting as well as the dependencies between these components. More explanations on how components and their interactions can be defined are provided in granularities of analysis section of the manual. There are couple general rules on how granularity affects the propagation rules:
- If a finer granularity is selected, the computer marks as Next the neighbors of all children (i.e. components that nest in the focus component) on the selected nesting level. If a coarser granularity is selected, the computer marks as Next the neighbors of the selected parent (i.e. component in which the focus component nests).
- Propagation rules act on all dependencies of a selected component, including dependencies defined in the component itself as well as dependencies defined in the members of this component.
- Rules applied at Edge level will act strictly on the one selected dependency (edge) - between the component, whose context menu is activated, and a component selected from the “Edge level" submenu (see assigning marks).
- Rules applied at selected text will act on the components called from the selected text and the components that are calling the components defined in this piece of code (see assigning marks).
Generally, the granularity, on which the rules are applied has a direct impact on how many neighbors will be marked as Next.
References
[1] Petrenko, M and Rajlich, V., "Variable Granularity for Improving Precision of Impact Analysis", in IEEE International Conference on Program Comprehension, 2009, pp. 10-19.