Jump to content

drjdpowell

Members
  • Posts

    1,986
  • Joined

  • Last visited

  • Days Won

    183

Posts posted by drjdpowell

  1.  Consider the class, NotifyUser.lvclass ...

     

    Looking at this one, I would get rid of the child classes entirely and just have two VIs, “DisplayMessage-Bool” and “DisplayMessage-Numeric”. But this is perhaps because the example is (as most examples are) a very simple case.  Even with child classes, though, I would just rename the methods.  

     

     

     Now, with "Must Implement", we have the ability to contractually require functionality in subclasses while maintaining the ability to extend parent class functionality, having acknowledged that Dynamic Dispatch is the incorrect tool when distinct function interfaces are desirable.

     

     

     

    I’m not sure it is desirable to "contractually require functionality in subclasses”.  That’s the author of the parent class trying to constrain and dictate the design of every yet-to-be-thought-of child class.  Too easy to over-constrain.  “Must override” and “must call parent” are different in that they are often actual requirements to make the child class function with parent-type code, and thus it is reasonable for the parent’s author to dictate this.

  2. The parent class is saying "if you want to be like me, you have to do at least this; you can do it however you want, but you gotta do it."

     

    Just my two cents, but as the designer of a child class, I wish to have my child objects function properly in code written for the parent (and thus am interested in overriding and/or calling parent methods where required), but I am not actually interested in being required to do things with code written for the child.  

  3. The “shared clones” setting affects operation of statically-called VIs (such as an ordinary block-diagram use).  Dynamic use depends on the options to the “Open VI ref” function; in your case option 0x8 creates a new clone with each use (with “auto dispose ref” you are destroying the clones and just reusing the clone numbers in new clones).

     

    To use “shared clones” dynamically, look at the NI example "AsynchronousCallAndCollectUsingOption0x40.vi”.

     

    — James

  4. Yes you are right, but just see the code inside dvr because of which I had to use dvr (which was not part of my design).

    That code should work fine without the DVR.  It shouldn’t hang the application.  

    — James

    BTW> look into “Variant Attributes” as a higher-performance way of doing look-ups like that.

  5. Unless your hardware uses push streaming (rare as rocking-horse droppings). The hardware cannot tell the UI since it will be CMD->RESP.

     

    One can have a “Hardware” actor, that is the only process to actually communicate with the actual hardware.  That actor pulls from the hardware, but pushes status changes to other actors.  [AQ may be thinking of this “Hardware” actor rather than the actual hardware.]

  6. Random comments:

    1) An “action engine” is a by-ref construct very similar in use to a DVR, so I don’t understand how you could have experience application hang with an action engine.  Having an action engine with a DVR inside it seems redundant and overly complicated.

    2) I actually have some mixed by-val/by-ref objects, but they are “naturally” that way, because they are a by-value object that “decorates” or extends a reference.  For example, a “configurable forwarding address” which wraps a communication reference (queue, etc.) with by-val instructions on how to modify messages sent to this reference.  I also have some mixed objects that I would probably have been better off making entirely by-ref.

  7. One other useful technique is to create an “abort” notifier in your “Controller” process, pass this as part of a “Do<whatever>” message, and have the execution loop check this notifier at appropriate points.  It can even use “Wait on Notification” in place of any “Wait” nodes it might require.  Package the “wait on notification” inside a subVI that outputs a “process aborted” error cluster, and you can stick it in any chain of subVIs sequenced by the error wire.

     

    — James

     

    PS to Daklu> I was excepting you to mention a true state machine as a “Sequencing alternative to a QSM”.

  8. If you’re following the Actor Model then actors should not share data by-reference.  This means that different Actors often must either keep a copy of the info they need, or request the info from other actors when needed (the first option is probably best).

     

    For your “Resistance=5” example, the UI could send a “Set Resistance Request” Message, and the Controller would check the value against its copy of the parameters.  If invalid, it would sent a “Resistance=<old> value” back to the UI, followed by some message to display a warning to the User.  If valid, it would send a “Set Resistance” message to the Hardware Actor.  The Hardware would then send a “Resistance Update” message to the Controller, who would send a copy to the UI.

  9. Funny, I got my CLA late last year with exactly the same set of marks, 10-16-18-26, with an architecture quite different than the example. I was annoyed by the low architecture mark, as I felt the architecture was complete and solid.

    — James

    PS. I was particularly annoyed by a comment of "Architecture not abstracted to switch over to field hardware.” I used abstract parent classes, with “Simulated” child classes injected at runtime, and a large comment explaining the intention to replace the simulated modules with hardware ones as required.

  10. FYI my IT department blocked all my file uploads a while back, and I had to request special permission to be able to upload stuff to lavag.org.

    Tried it from a totally different location on a different computer.  Same thing, same symptoms.

     

    Could someone else have a go at trying to upload something to the CR?  You don’t have to actually complete the submission; just try and upload a file.

  11. I would still have to create some sort of case structure (perhaps not, though, because all my child classes will probably have overridden the VI in question) and/or a sequence that would rely on working with the paths of the VIs, correct? 

    No.  The static VI just calls the dynamic VI, passing in the class instance and so allowing dynamic dispatch.  Below is the static VI I use:

    post-18176-0-52608400-1357657741.png

    • Like 2
  12. I have a 2D array in a cluster in a 1D array in a cluster. after flattening, in the JSON string, the 2d array looks like 1d. if I try to unflatten this string to my cluster, the variant to data primitive throws me an incompatible datatype error. it seems, 2d arrays are generally unsupported?

    I am having a problem uploading a new version to the Code Repository, but you can download it from bitbucket.  It is extended to work with multi-D (rectangular) arrays.

  13. On the question of whether LV is object oriented or actor oriented: Neither, inherently. Both of those are design styles, and they are orthogonal to each other. One speaks to a way of data packaging (object) and the other speaks to a way of controlling execution flow (actor). 

    Are they “orthogonal”?  Actors encapsulate their internal data, and messages to the actor can be thought of as methods of an object.  

  14. Hello,

    I’ve just found that I can’t upload files to the LAVA CR.  I was trying to submit a new JSON LabVIEW version and I kept getting a “This Upload Failed” error message.  See below:

    ...

    Well, I was about to attach a png image to this post to show the error, but I couldn’t, as I have the same error when attaching files to posts  :angry:   

     

    Anyone else have the same problem?

     

    — James

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.