Jump to content

Design pattern OOP


Recommended Posts

Posted

Hello Everyone,

I am new to object oriented programming in LabVIEW. I am working with injector measurement system in LabVIEW that use (Procedure Programming Style) Producer Consumer Design pattern

After careful reading about object oriented, I come to know its benefit. So I want to use OOP in my current application. Anyone could give some idea which design pattern is equivalent to producer Consumer.

Thank you in advance .

Posted

Hi Bhavin,

It depends on what you want to achieve. If you are new to OO I would suggest that you keep with the standard Producer Consumer pattern and just start changing some of your code to use classes. Anywhere you have libraries, custom clusters or FGVs are good indicators. This lets you get used to the basics without getting bogged down in more complicated design patterns.

What you have to remember is design patterns are all solutions to a single problem so if you don't have that problem then don't rush to use them as they can make your code more complicated.

If you really want to take a look at one though the most equivalent is the command pattern. This allows you to add actions to the consumer loop without having to change its code at all (the problem it solves). But as per my warning above, I use OO all the time and have still never used this in anger!

Posted

If you want to access the same object from 2 different  loops, you have to have use an Object By Reference solution.
But you can use the Command Design pattern to send Object By Value from the producer to the consumer loop.

Join the conversation

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

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.