User Tools

Site Tools


kb:bestpractices:codingconventions:documentation

03 Documentation

Comments

  • Comments should explain the „why“, not the „how“
  • Using hashtags (see below) enables Bookmark Manager usage

Comment Colors

Description RGB Color Code LV-internal Color Name
NI Default 255/255/215
NI Code Recommended 145/251/254 “template comment”
NI Example Code 255/179/42
HSE 108/0/128
DQMH HowTo 173/180/211 “tank housing”
DQMH MHL 136/255/215

Hashtags

#docgen XX Functional description of VIs. Optional: Sequenced with numbers starting with XX=01
#todo-abc Functionality is missing. Optional: Append intials (3 letters) to #todo for personalization
#fixme Errors that need fixing
#coderev Remarks during Code Reviews
#optimize Potential for optimization (v.A. FPGA)
#covers Marks code that directly deals with a certain requirement
#HSE Code specific to the HSE way of working in our templates
#DQMH_Howto Code specific to the HSE way of working in our templates
#CodeRecommended Code specific to the HSE way of working in our templates

Labels

  • Case Structures
    • Display label and put a question describing the purpose of the case structure
    • Display subdiagram labels and answer the question for each case
    • Optional: Color the expected case(s) - the “sunshine scenario” - in light green (RGB = 225/255/225)
    • Optional: Color errors in light red (RGB = 255/225/225)
  • Subdiagram Labels are to be displayed and filled with text
    • Exception: Error Structures
    • Tools → Options → Block Diagram → Tip Strips & Labeling → Subdiagram Labels visible by default
  • Constant Labels are to be displayed and filled with text
    • Tools → Options → Environment → Show created constant labels

VI Properties

  • „File → VI Properties“ or „<Ctrl>-I“
    • Select category „Documentation“
    • „VI Description“ contains the text that is displayed in the context help window

Quickstart Template VIs

Quickstart VIs will have a comment placed on their block diagram as follows:

  This is a quickstart VI: A very simple example for using this package.
  
  This project ships with several examples which you can browse from 
  the Example Finder ("Help -> Find Examples…" menu item in the LabVIEW IDE).
  In the NI Example Finder, browsing the directory structure, navigate to "\HSE" 
  or "\Hampel Software Engineering" where you will find additional example VIs.

Projects

  • Every project needs a readme.md
    • sits at the root of the repo
    • describes the basic structure
    • links to resources (like hie-libs documentation)
    • lists dependencies and requirements (also .vipc?)

UML

Use PlantUML for server-side generation of diagrams from plain markdown text. Both Dokuwiki and Gitlab support PlantUML.

GitLab Syntax

  ```plantuml
  @startuml
  Alice -> Bob: Authentication Request
  Bob --> Alice: Authentication Response
  Alice -> Bob: Another authentication Request
  Alice <-- Bob: another authentication Response
  @enduml
  ```

DokuWiki Syntax

  <uml>
  @startuml
  Alice -> Bob: Authentication Request
  Bob --> Alice: Authentication Response
  Alice -> Bob: Another authentication Request
  Alice <-- Bob: another authentication Response
  @enduml
  </uml>

See Processes/Dokuwiki for a rendering example.

External Info

  • If there is an external source of information, then mention it or link to it on the block diagram
    • eg when reimplementing an algorithm from a text-based programming language, add a screenshot of the code fragment
    • when working towards external specifications (eg implementing a protocol), link to the official documentation

VI Documentation Generator


The HSE Way of Working:
A set of guidelines that recommend programming style, better practices, and methods for all our LabVIEW projects. We ask all our peers to follow these guidelines to help improve the readability of our shared source code and make software maintenance easier.

kb/bestpractices/codingconventions/documentation.txt · Last modified: 2025/01/29 08:29 by joerg.hampel