I am self-taught in LabView like most people in academic science, but
the main VI I use has finally become sufficiently complex that I have
to worry about memory management and other concepts that beginners
don't normally worry about.

so I read the "LabVIEW Performance and Memory Management - Tutorial"
http://zone.ni.com/devzone/conceptd.nsf/webmain/732CEC772AA4FBE586256A37005541D3?opendocument
which was pretty informative.  But the document brought up several
questions regarding efficient memory management and style:

1. First, they tell you to avoid using complex data structures such as
clusters, clusters of clusters, arrays of clusters, etc.  But if you
have a complex VI, you really have no choice.  There's only so many
terminals one can put on a sub-VI, and even if you could put more, you
wouldn't want to have 100 wires sticking out.  The tutorial tells you
to do stuff like, have separate arrays of data of a single type.  I
can see how this is more efficient, but then when you want to pass one
set of data (that would normally be in a cluster) to another VI , you
have to index all N arrays, stuff them in a cluster, then put them
into a sub-VI.
   That's hardly an optimal solution, coding wise, and more
   importantly, style-wise.  I worry about style because, (a) I'm about
   to graduate, and I have to pass my code onto someone else, (b) it
   saves a lot of development time, and (c) my programming courses in
   college beat on style relentlessly.
      In the C and Java courses I have taken, I've always been taught
      to encapsulate data into logical data structures.  It would seem that
      clusters are the analog of structs in C or objects in Java, and I'm
      sure there are plenty of very complex VI's out there that must use
      such data structures. <b>Is there a way to make cluster use more
      memory efficient?</b>  Right now, I use references to clusters, but
      the "Memory Management" tutorial says that when you use attribute
      (property?) nodes in a Sub-VI, you then have to allocate memory in the
      Sub-VI for the front-panel controls referenced.  So that would seem to
      defeat the purpose of using references to avoid making a copy of a
      complicated data structure.

2. The tutorial also says to avoid using local variables and instead
use "data flow" programming, such as shift registers and continuous
wires that go into, through, and out of loops.  But, again, if you
have complex program, you're going to have a ton of wires stretching
across your VI, especially if you're not encapsulating your data in
clusters. And you'd have to cross wires, which is apparently a big
no-no. <b>So how do you use data flow programming wihtout making your
VI impossible to read?</b>

3.  <b> Is there a way to use LabView in a more object-oriented
way?</b> LabView touts itself as being object-oriented, but it doesn't
really let users take advantage of that.  I can see that LabView and G
itself is based on object-oriented code, but users can't really make
their own objects and manipulate them as they can in C++ or Java.  I
realize that there are add-on packages you can buy, but it seems that
they don't really give all the functionality of an Object Oriented
language (e.g. interfaces, real polymorphism).  It seems that at least
some sort of ability to make objects and classes would let people
clean up their code.  Whether that overhead would increase memory use
unacceptably is something the NI engineers would have to worry about.
I guess the debate over performance vs. style is pretty general to all
languages.

4.  <b>Is there any way to learn good LabView style?</b>  as mentioned
before, most people in my field are self-taught.  There haven't any
LabView classes at the schools I've been to, and I don't have a lot of
time to  travel to or take the NI-sponsored classes.  My and of my
lab-mates' VI's are gawdawful messes of tangled wires.  LabView the
development environment doesn't really seem to force you to use some
semblance of style like, say, Java does. I know the whole "wires go
left to right" bit, but that only takes you so far, and I had been
using LabView for 3 years before I found that one out.

5.  I'm using LabView 6.1.  <b>Is LabView 7 more memory/performance
efficient?</b>  Or do the new bells and whistles make it less
efficient?  In LabView 6.1  I've noticed that tab controls slow down
things quite a bit.

Anyway, if you have any answers or comments, I would appreciate your
input.

Reply via email to