02-13-2013 07:31 PM
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.
Solved! Go to Solution.
02-13-2013 08:18 PM
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.
02-13-2013 10:11 PM
// probably.
Free text labels are much easier to use Search for "Here.vi" Steve Chandler had some additions to suggest. //end comment
02-14-2013 06:15 AM
@JÞB wrote:
// probably.
Free text labels are much easier to use Search for "Here.vi" Steve Chandler had some additions to suggest. //end comment
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.
02-14-2013 07:04 AM
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.
02-14-2013 07:14 AM
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
02-14-2013 08:45 AM
@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.
02-14-2013 10:33 AM
@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!
02-14-2013 11:19 AM
@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!
02-14-2013 11:39 AM
Excellent stuff, Jeff! I'll have to remember this when I use LV 2012. 🙂