George Gatling wrote: > I am pretty surprised to hear so many people clamoring to keep the top > level VI laden with code. In nearly all of the other languages (admittedly > those crude text based ones) the convention is to keep main() or its > equivalent relatively codeless, except to start the necessary objects or > loops. Let me be the first to say the analogy between the top level vi > and main is not wholly accurate, but they are certainly similar. > (...) > Now, performance aside, why is it so critical to have all of the panel > update contained in one potentially mammoth vi? It is no big deal if > there are only a few indicators. But when you start really piling them > on, managing them becomes a pretty big deal.
Separating the user interface from the functionality it drives does indeed make for a more scalable design. But LabVIEW has this very convenient front panel/diagram abstraction: throw controls/indicators on the front panel, and directly wire up the terminals on the diagram. Want to find out what a knob does? Just pop-up and select "find terminal" to see what it is wired to. Such ease of use and transparancy is worth a lot. Doing everything by reference requires much more infrastructure and is harder to analyse. On the other hand, doing everything on the front panel's diagram does not scale. Personally, I try to have the best of both worlds by attempting to stick to these rough guidelines: * Pure user interface logic goes on the diagram associated with the front panel (typically a state machine state or event case per control or indicator). * Non UI application logic, application data, and background processes are accessed via subVIs, LV2 style globals, queues, VI server, and so on. * Make user interface VIs as small as possible by splitting the application into multiple windows and dialogs, each with only a single limited purpose. * Organize the separate windows into a whole using a start menu. Grouping them as subpanels might be a good alternative, but I can't vouch that yet. Albert-Jan --- Dr. A.C.J. Brouwer CIT Egineering Nederland BV http://www.citengineering.com
