Jump to content

cleaning up my program


Recommended Posts

I am trying to clean up my program by reducing the number of wires and I was wondering is there any advantage to using property nodes (value) vs local variables. I just want to pass values from one function to another with out having the clutter of wires everywhere. Is one way faster then the other, are there situations where I don't want to use one of the ways. Please tell me if there is something I can read, or if you can give me any advice off the top of your head.

Link to comment
I am trying to clean up my program by reducing the number of wires and I was wondering is there any advantage to using property nodes (value) vs local variables. I just want to pass values from one function to another with out having the clutter of wires everywhere. Is one way faster then the other, are there situations where I don't want to use one of the ways. Please tell me if there is something I can read, or if you can give me any advice off the top of your head.

Locals will update much faster than property nodes , so , if you need to worry about speed you may want to look into the locals...

Dan

Link to comment
I just want to pass values from one function to another with out having the clutter of wires everywhere.

Beware, LabVIEW is all about wires... :laugh:

Seriously, I think you should think twice before removing all your wires in favour of Locals. With Locals you have less control of the flow, and you can run into race conditions.

You might want to have a look at one of the GOOP implementations, these can replace all your data by a reference to that data (basically you get a by-reference approach).

/J

Link to comment

Locals and property nodes are equally bad. Both cause thread swaps to the user interface thread to access the data of the front panel item. Rule of thumb is to use property nodes to read/write values if you read/write other properties as well, otherwise use a local. Wires remain the best way of transferring data even though they somes look untidy. I generally avoid locals like the plague since tracking where you've used them can become a bit hectic in a large app.

Link to comment
I am trying to clean up my program by reducing the number of wires and I was wondering is there any advantage to using property nodes (value) vs local variables. I just want to pass values from one function to another with out having the clutter of wires everywhere. Is one way faster then the other, are there situations where I don't want to use one of the ways. Please tell me if there is something I can read, or if you can give me any advice off the top of your head.

You might really miss the wires when it comes time to debug or reuse the code. Property nodes are really for changing properties. Even though "value" may be a property, notice all the other stuff - that's what a propety node is mostly used for.

Locals obscure what is going on when you look at the code. One of the main reasons for graphical programming is to give an intuitive feel to the data flow.

Honestly, I find it inconceivable that I would get rid of wires. Very bad juju. There are other ways to clean up code.

You should be making good use of Create SubVI to clean up. I try and make my Vi's so I don't have to scroll much past the borders of the screen. Good architecture and sub vis make this possible. Learn about some of the architectures like Event Driven Producer Consumer, etc.

And you can bundle and unbundle clusters of the various types of data. You should avoid clustering datat that are unrealated in their function just for cleanliness' sake.

I would say don't do it with locals until you have used LV for a while. And pretty code is the least of your worries to start with.

Mike

Link to comment

Thanks for the feedback guys, I am glad I asked before I started doing some hardcore modification. I am most concerned about speed. I think I will leave the wires, but use locals where things get cluttered. Where I am passing constant values I will use the locals, for my arrays I will leave the wires. Thanks for the advice about making sub vi's Michael, I have already used this approach for many of the routines I am working with and find this a great way to keep things less cluttered.

Link to comment
Thanks for the feedback guys, I am glad I asked before I started doing some hardcore modification. I am most concerned about speed. I think I will leave the wires, but use locals where things get cluttered. Where I am passing constant values I will use the locals, for my arrays I will leave the wires. Thanks for the advice about making sub vi's Michael, I have already used this approach for many of the routines I am working with and find this a great way to keep things less cluttered.

As already stated, i suggest STRONGLYYYYY that you look into clusters, they can clear up wires and organize your information.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.