"Manno" wrote in message
news:50650000000500000069600000-1012609683000@exchange.ni.com...
> Yes, I have the GOOP toolkit already. what I wanna know is when do I
> impletment the hardware part. do I implement it in the create class
> for else where?
>
> I have a sample vi that here that I was playing with, I will attach it
> for you guys to see. Please give some feedback on it.
> Manno
I took a look at your sample VI inside the LLB. It didn't load perfectly; I
didn't see the data members CTL. However I think that I got the general idea
of what you were doing.
Your "top-level" VI called TurnThemOn.vi is too complex because you have the
implementation details (DigPort write) on the diagram. For a possibly more
elegant solution, try the following ideas:
- Make your lampCreate VI accept any necessary parameters for "creating" the
object in question. This might be DAQ card, DAQ channels, frontpanel control
reference for a software lamp, etc. Store these within the object as
constants for later use. It seems to make sense to have multiple lamp
objects.
- Although this example was very simple, it helps to divide every piece of
data in the system into logical categories. On a recent labview project I
conceptualized three main groups: controls (sliders, parameters), indicators
(graphs), and things which cause events (menus, buttons).
- Handling (more like hiding) the hardware becomes easy at this point. You
have the object reference which holds all the data necessary to control the
device appropriately. Maybe create a member function like controlLamp.vi
which gets its necessary data from the object reference (DAQ channel
number?) and uses that to turn on/off the lamp correctly.
- How can you tell if your solution is elegant? The interface should be
abstracted from the implementation. If the hardware changes, will your
top-level VI have to change? Hopefully not, because the OO design allows the
programmer to use concepts at the top-level and details hidden in
lower-level functions. If the GUI changes, will the top-level VI have to
change? Also hopefully not, because the GUI simply inputs parameters,
displays results, and generates program events. The objects hold all the
data, and the top-level VI specifies the algorithm at a conceptual level for
processing that data. The interface doesn't have to change the algorithm.
- Once you're past this simple example, the design might become slightly
more difficult. For good performance you'll need to remember parallelism.
This brings up issues of race conditions, deadlock, VI atomicity,
re-entrancy, and all that fun stuff. Just watch out! GOOP is the only way to
do large Labview applications, but it exposes a lot of issues that basic
Labview programmers rarely have to worry about. Be warned!
Good luck with your efforts. Post any more questions, I certianly didn't see
many postings when I was getting used to this programming model. It might be
able to help others.
-joey