> 1- Do you think that LV was built to support OO Programming?
LV was initially designed in 1983. OOP existed at that point,
but LV wasn't designed to be OO. It was designed to allow
engineers and researchers a simple language appropriate
for controlling their research labs from a computer.
> 2- Is OO the only way we have to support large applications, or is it
> feasible to support it with a good dataflow architecture including all
> the flowcharts and all the data definitions?
OO lends itself to large projects because it provides
abstraction, encapsulation, and organizes code into
modules that can more easily be implemented independent
of one another since they can be specified in finer
detail. Also, the compilers help to enforce the
specifications providing they can be encoded in the
interface between objects.
These OO principles were already a part of big projects
long before there were OO languages. It was just that
the language didn't necessarily have features which
supported it. Similarly, they can be a part of big
projects today despite the language being used.
LV 2 style globals, which as the name suggests were
in use long ago, encapsulate data with an interface.
They disallow arbitrary access to the data and can be
used to enforce correct access. With other functions
layered on top, you get a nice interface to stored data.
Functions and structs/clusters abstract away details.
Building a subVI that does an FFT means that for 99%
of the uses, you don't need any more information except
that this block performs an abstract mathematical function,
an FFT. The implementation can be completely changed
to speed it up or make it more accurate and your code
isn't affected. Its abstract definition still holds, so
your code still works.
There are other things that OO languages bring to the
table that LV, and GOOP don't yet offer. In my opinion,
a few more OO features can be added to LV to allow for
even larger projects in the future provided they are used
well.
Earlier posts pointed out that C++ doesn't guarantee that
a project will succeed. OO features are just another tool,
and the tool can be misused leading to a failed project.
This is true to LV, C, C++, and all other engineering tools.
The key is using the tools at hand to best solve the
problems we face. Not glorifying or blaming the tools for
the state of the project.
> 3- Is LV going to stay "dataflow" or is it going to become OO?
LV is dataflow to the core. The definition of what data
is flowing may be expanded, but it will still be data
flowing down wires from one node to another that accounts
for how the program executes.
One of the limitations of the current GOOP is that all
objects are dealt with by a reference. By adding
language features, objects could be made to flow down
the wire, just like strings and arrays, meaning that
branching a wire doesn't lead to side-effects,
and there is no need to dispose objects.
> 4- What would be the great benefits of turning LV to OO that we don't
> already have with the dataflow approach?
Remember when LV didn't have typedefs? It was easy for
a cluster datatype to change once a project was underway.
That usually led to lots of edits on other panels to get
them back in synch. Without the unbundle by name, you
then went through the diagrams fixing all of the bundlers
and unbundlers to have the right number of terminals.
Changing the order of the cluster was even worse since
the diagrams may not bread, they might just access the
wrong field instead.
In many respects, an object is just another step along the
same path. An object is a typedef that can have code
associated with it for access -- maybe like Array and
Cluster Tools. Some of the typedef contents might be
publicly accessable, like now, while other elements are
hidden, only available to the implementation of the
typedef. That would force the user to use your functions
to manipulate things rather than hacking away at the
typedef contents. As an example, a LV string is really
just a cluster of size and characters. Since the diagram
can only modify the string using the string functions, you
never get the size and characters out of synch. That is
until you take it into LV generated code, a DLL or CIN
where you have access to the inner fields.
A related problem is that current typedefs are transparent
to built-in LV functions. If your typedef is just some
numbers, LV will be happy to perform arithmetic on your
typedef. Maybe this is what you want, but if this doesn't
make sense on your typedef, then your left with adding a
Boolean or a string so that the arithmetic isn't allowed.
Ideally, you would be able to state that = makes sense, >
and < don't, + and - only operates on the first numeric, and
* is something that you implement yourself. There would be
some safeguards so that the user of your typedef, which
includes you, wouldn't accidentally mangle the typedef
contents.
These may not seem like much at first, but they allow for
much more abstraction and better encapsulation. Finally,
there is a technique called inheritance that allows for
similar objects to be acted on by common code in one
location, and by specific code in another location depending
on which type of object is actually there at runtime.
This of usually done today by switching out on some inner
tag and dealing with each type in its own diagram. This
works fine until projects get large and teams get large.
Inheritance is a different way of implementing the exact
same thing that usually works much better for bigger teams
and bigger projects.
> 5- My opinion is that trying to implement OO in LabVIEW, is like trying
> to
Is this a fill-in-the blank question? It is difficult today
because the LV language doesn't yet support OO very well.
Early C++ was implemented on top of C using just a bunch
of macros and the preprocessor to mangle the C++ back into
C so that it could be compiled and run. Debugging was
done on practically unreadable text that vaguely resembled
your original code. By comparison, GOOP actually looks
pretty good. It is written entirely on top of the current
LV language and makes clever use of things like datalog
refnums to make strict types.
Over time I think GOOP will mature, and like typedefs,
some users will come to rely on it in a big way.
Other users will hopefully not even notice that anything
changed. If their project grows in complexity and they
need another tool to manage things, it will be just
another feature that helps them to get useful things done.
Greg McKaskle