It does not have to be a class, here I changed it to a cluster and updated the DVR refnum and the rest of the code stays the same (in that example).
Ok so I'm clear on that now.
Ok, so now you have a wrapper methods and you have created a robust API IMHO - I like this API think it is robust like the DVR and the AE I posted e.g. you could change the implementation of underlying code (from DVR/Variant/AE) and it would not affect the API or end user.
However, I would disagree that it less work than the DVR module I posted:
That's not what I said. I said it wasn't a fair comparison (your original AE and the super slim one) and that there is little difference in effort for the
more equivelent one I supplied.
So the example I posted (and you modified) is quite simple.
It's different? Wasn't intentional. I did save As (copy) a few times so that I didn't have to re-invent the wheel. Maybe something got messed up when it recompiled.
How are you going to handle multiple inputs for a method?
E.g. each method has 2 or more inputs.
For your implementation (variant) I see two options (there may be others?)
- More Variant inputs on the CP of the AE
- Or the interface to the AE stays the same and you create a typedef Cluster of the inputs for that method and convert them back on the other side.
In (1) more variant inputs could get messy fast and hard to manage in the AE?
<snip>
In (2) creating a Cluster means that you are going to have the exact same issues I have highlighted in terms of boiler plate code.
No 2. With a slight variation (I know you will pick me up on moving the typedef cluster outside the AE, but in the long run it's worth the "potential" pitfall. If we are supplying accessors, then it's only a pitfall for us, not the user). So I am deliberately sacrificing a small bit of robustness for a large gain in flexibility.
Accessor
AE
I don't think it's any different to the boiler plate code that you have to use with a DVR. But there is a big motivation for doing this as I hope you will see a bit further down.
So the typing issues has to do with the inputs/outputs to the AE not the state (persistent) data of the either module.
The DVR is the state (albeit a reference to the state - accessed safely using the IPE)
The DVR method inputs/outputs do not need to be isolated/grouped/protected etc... as there is only a single VI that will use them.
In order to handle multiple inputs I don't have to do anything special, thus this makes the DVR less coding.
Not strictly true. You still have to create the bundle and un-bundles in the accessors (and the extra controls/indicators etc) the same as I do in the above images (if changing a current implementation). If you are adding new "Methods" then yes. It only affects the new VI. Wheras I (may) have to create the new VI and add the cases to the AE.this is the point I was making about selection via frames or via VIs. This, however is both a strength and a weakness for the DVR method
.
IMHO the classic AE is not as robust, I have already addressed the following as to why I think it is not and why it should be wrapped to provide a more robust API to the end user:
Additionally the Command Enum should be private/hidden as e.g. this will not allow user to run private methods.
Point of interest/view etc. I don't consider AE=API.An API might be composed of many AEs which are self-contained sub-components. (Maybe that's just in my world though)
Considering what I just said, the Cmd enum is not private in an AE, it is public. Why should it be private? (what was I saying earlier about anal computer science?). We want the user to be able to choose the methods and there is nothing in the AE that he shouldn't be accessing (unless you've not partitioned correctly and have loads of methods that are internal only-
a state machine is an abuse of an AE!). If it's not on the enum, then he can't access it so why go making it harder for him to do so? You wouldn't go making a drop-down on a front panel private, would you?
I like the DVR method, now I know more about it and will certainly be looking at some of my current implementations to see if this type would be better. But it has one weakness which (as I stated earlier) is also it's strength.
So here's the kicker.
It has one accessor (VI) for each and every method! We've covered the ground with different inputs and (I think) there is little in it (but the DVR is definitely in the lead at this point). What if we have multiple methods but the
same input type?
Lets say we have in our AE example the boolean input but we can do AND, OR, XOR, NAND, NOR, NXOR etc. Thats 6 more accessors (VIs) for the DVR all looking remarkably similar except for the boolean operation. That's not promoting code-reuse and and inflates the code-base.
This is the (single) accessor for the AE with the 6 extra operations (1 extra type-def).
I have to modify the case structure to include the extra operations, but I only have 1 "vi" and 1 typedef ("boolean Method") to maintain regardless of the number of boolean operations. The codebase also doesn't change i.e there is zero increase in the number of VIs for increasing boolean operations. This is why partitioning is so important. If you can partition your engines so that they are grouped "by function" then maintenance is easier and code re-use is increased . The DVR code-base seems to increase linearly with the methods and there also seems to be zero opportunity for re-use of the accessors.(not mentioning the compile time here

).
Edited by ShaunR, 29 December 2011 - 07:17 AM.