LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Am I commenting wrong?

Solved!
Go to solution

In an effort to keep my code organized, I like to use many diagram disable structures to enforce routing and layout, and to put comments in the disabled section. Usually I put the comments in a formula node rather than the yellow comment box because I find it easier to format the text this way. I like the way this works visually, but I am wondering if this is causing any unexpected overhead, either in overusing diagram disables or in having non-functional forumlas nodes lying around.

0 Kudos
Message 1 of 22
(3,345 Views)

I think you are making you code less readable, Lots of diagram disable structures will lead to confusoin about what this "code" is and why it is there. Simply use a free label to comment your code. If you are using LV 2012 you can use the structure labels for commenting code.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 2 of 22
(3,336 Views)

// probably. 

 

Free text labels are much easier to use Search for "Here.vi" Steve Chandler had some additions to suggest.  //end commentSmiley Wink


"Should be" isn't "Is" -Jay
0 Kudos
Message 3 of 22
(3,321 Views)

@JÞB wrote:

// probably. 

 

Free text labels are much easier to use Search for "Here.vi" Steve Chandler had some additions to suggest.  //end commentSmiley Wink


Jeff, you C code would through an error there.  You should use /* */ to comment sections.  // only comments out lines.

 

fboric, what do you mean by rounting and layout?  If you are breaking up your code, that sounds like a canidate for a subVI.  I'm not sure why you need a structure to enforce routing.  Are you using them to enforce data flow?

As already stated, simple free text labels are all you really need to comment code.  Another trick I use a lot (and it helps a lot) is to use the structure's label.  For case structures, I set the label to what the question is (ex: "Is the button on?").  If not completely obvious, use the subdiagram labels for each case to explain the answer and what you are doing because of it.  For FOR loops, I usually set the label to tell me what I am iterating on and what I'm actually doing in the loop.

 


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 22
(3,285 Views)

I have to agree with suggestions made earlier: use the structure label and use free labels. I don't know why you would go through all the effort to make comments and then put them into a formula node. That could be confusing.

PaulG.

LabVIEW versions 5.0 - 2023

“All programmers are optimists”
― Frederick P. Brooks Jr.
0 Kudos
Message 5 of 22
(3,273 Views)

You can show labels on structures and give them good names if you need some extra documentation, else the free labels should be enough, combined with lots of well named sub-vi's. 🙂

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 6 of 22
(3,266 Views)

@Yamaeda wrote:

You can show labels on structures and give them good names if you need some extra documentation, else the free labels should be enough, combined with lots of well named sub-vi's. 🙂

 

/Y


And the subVIs should have documentation as well. Basically, don't forget to add documentaion to the VI's properties.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 7 of 22
(3,242 Views)

@Mark_Yedinak wrote:

I think you are making you code less readable, Lots of diagram disable structures will lead to confusoin about what this "code" is and why it is there. Simply use a free label to comment your code. If you are using LV 2012 you can use the structure labels for commenting code.


Hi, Mark:

 

I've always used structure labels to comment.  On this machine, I have LabVIEW 7.1.  You just have to make the label visible.  Or is this handled in a better way in LV 2012?  Thanks!

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 8 of 22
(3,222 Views)

@billko wrote:

I've always used structure labels to comment.  On this machine, I have LabVIEW 7.1.  You just have to make the label visible.  Or is this handled in a better way in LV 2012?  Thanks!


1!.PNG


"Should be" isn't "Is" -Jay
0 Kudos
Message 9 of 22
(3,212 Views)

Excellent stuff, Jeff!  I'll have to remember this when I use LV 2012.  🙂

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 10 of 22
(3,202 Views)