LVOOP Programming Recommendations

This page contains a list of programming recommendations for Object Oriented Programming with LabVIEW.

  • Naming conventions
    • Follow the C++ naming convention, e.g MyClass, myAttributeName, doSomething().
    • For classes use Prefix_ClassName
    • Use set_myAttributeName.vi and get_myAttributeName.vi for data access VIs.
    • Use following names for the dynamic class parameter: IN: ClassName in, OUT: ClassName out.
  • Class
    • Add Description: Class responsibility, Author, History and copyright info. GPL is recommended.
    • Add Description also to ClassName.ctl .
    • Class wires: Select a remarkable wire type for ancestor classes.
    • Dynamic dispach VIs
      • You should indicate them with little open squares in the upper left and right corner.
      • You should add a hint to the VI description, e.g. This is a dynamic dispach VI.
    • Override VIs
      • You should indicate them with little open squares in the upper left and right corner.
      • You should add a hint to the VI description, e.g. This is an override VI.
  • VIs
    • Connector Pane: Use 622226 (second from right in lower row). You can set the default in the LabVIEW.ini: defaultConPane=4834.
    • Add Desription to VI, controls and inidicators.
    • Supply reasonable icon.
    • Use labes of programming structures for inline documentation.
    • Check range of input and output parameters.
    • Check error
      • On entry
        Return reasonable output parameter values in case of error.
      • Class typecast
        Be aware that typecast returns a default object in case of error in = True . Make sure that you do not loose the original object.
    • VI Names
      • Attribute access: Use get_anAttribute.vi and set_anAttribute.vi
      • Boolean Status: isSomething.vi
      • Other: use a verb in the beginning of the name, e.g createObject.vi
  • Inheritance
    LabVIEW supports single inheritance only and no interfaces. If you think in terms of multiple inheritance, you need to reconsider your design.

-- HolgerBrand - 06 Mar 2007
Topic revision: r9 - 2009-06-18, HolgerBrand - This page was cached on 2024-12-19 - 18:44.

This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding GSI Wiki? Send feedback | Legal notice | Privacy Policy (german)