Jump to content

Difference Between Singleton || Function Global || Global Variable


Recommended Posts

Hi all! 

I am wondering about the following.. I have a very comlex OO structure and the top level object contains all the current classe ie. the backbone of the application. There are many events that can modify the current state of the program. ( set / update attributes for classes, save or load).

These events are generated in very special parts of the code(even different VIs), so I have to place this top level object into many VIs in order to keep the dataflow but in this case the wiring is not acceptable. 

I have three alternatives:

  1. Global Variable : ~ Contains the top level Object, and Set the Global var. to Read / Write - the dataflow is given
  2. FUnction Global: at the init state of my program, The functin global initializes the top level object , and every time when I wanna use this object I have to create a new state for the function global (or use Get - Set states)
  3. Singleton DP. : I have never used this before, and I dont know how to combine the by ref. top level Object with the contained by value object. 

I dont know how to go on! I would be so greatfull if u could help me to choose right, or suggest me another soultion for my problem! 

Thank you very much.

(i think the real problem is, this is the first time when I am working such a great application. There is no problem for me to design the specific classes, write all the methods. but when i am at the point of  compile the whole program, I dont know how to compose all classes for one.) It is so sad that very difficult to find any quotes about application desing. )

Link to comment
It is so sad that very difficult to find any quotes about application desing.

LVOOP has only been out for 4 years. That might sound like a long time in computer terms, but in terms of writing high level programming design texts, it's very short. Having said that, this December, a revised LVOOP customer education course from NI will be available, which does include lessons on design. In the short term, there are several texts on designing various subsystems you can find by going to ni.com and searching in the search bar for "LVOOP FAQ" and scrolling to the bottom of the FAQ document -- it includes links to a few design papers. There's also good stuff for OO design in the 2010 NI Week presentations (instructions for accessing those are included here).

  • Like 1
Link to comment

LVOOP has only been out for 4 years. That might sound like a long time in computer terms, but in terms of writing high level programming design texts, it's very short. Having said that, this December, a revised LVOOP customer education course from NI will be available, which does include lessons on design. In the short term, there are several texts on designing various subsystems you can find by going to ni.com and searching in the search bar for "LVOOP FAQ" and scrolling to the bottom of the FAQ document -- it includes links to a few design papers. There's also good stuff for OO design in the 2010 NI Week presentations (instructions for accessing those are included here).

Thank you for your reply! I sent a join request to access to the private group! I think this will be very useful. BTW, what do you think about my other questioln? what and why do you choose that?

Link to comment

Thank you for your reply! I sent a join request to access to the private group! I think this will be very useful. BTW, what do you think about my other questioln? what and why do you choose that?

In general, go with #2 or #3, but each of those has enough advantages/disadvantages that you'll have to look at the behavior of your specific program.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

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