In LabVIEW programming, a common practice is to pass data structures—such as references, clusters, or classes—through SubVIs, even when these SubVIs only consume the data without modifying it. This approach maintains a consistent data flow, making the code appear orderly and aligned with traditional LabVIEW design patterns.
However, this practice can obscure the SubVI's actual behavior. When a data wire passes through a SubVI, it's not immediately clear whether the SubVI modifies the data or simply reads it. This ambiguity can complicate debugging, as developers may need to inspect each SubVI to understand its effect on the data.
An alternative approach is to avoid passing the data wire through SubVIs that do not modify the data. By doing so, the block diagram provides immediate visual cues about which SubVIs are purely consumers of the data. This enhances code readability and aids in debugging, as developers can quickly identify which SubVIs might affect the data state.
While this method may initially seem untidy or counter to established conventions, it offers practical benefits by clearly delineating data consumers from data modifiers. Adopting this practice can lead to more maintainable and understandable LabVIEW code.
In summary, reconsidering the necessity of passing data wires through non-modifying SubVIs can improve code clarity and debugging efficiency in LabVIEW applications.
For more details, refer to the original article on the DQMH Consortium blog: "Just Passing Through". and the presentation of Darren An End to Brainless LabVIEW Programming