LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Object Oriented Programming Use-cases

I want to start learning OOP in LabVIEW but am trying to conceptualize its usefulness when it comes to test engineering type of programs.  I mainly use LabVIEW to develop programs to automate hardware testing.

 

What are some real world examples where OOP would be useful when it comes to hardware testing?  The only thing I could think of is maybe making classes/objects for test instruments.

 

How else could OOP be useful?

 

Thanks

0 Kudos
Message 1 of 4
(1,040 Views)

I can tell you a lot of the ones we use at my company:

 

Test instrument parent, test instrument type as child, specific make/model of instrument type as grandchild

 

Test data parent, specific type of test data child

 

Recipe parent, general type of recipe child, specific station's recipe grandchild

 

Test step parent, specific test step child

 

DUT information parent, specific implementation of one DUT type child

 

All of these allow us to write "library" VIs that work with all parent classes, so we can do a lot of code reuse.  For those that have grandchildren, we often have library VIs that interact with the "child" level that get reused too.  

 

Also, just in general, having the ability to make classes have their own wire appearance can get helpful if your code is crisscrossed everywhere with pink cluster wires.

 

Another benefit in general is that if you have one developer making classes and another using them, then you can use the private/protected VIs of the class to prevent using them "wrong".

Message 2 of 4
(1,002 Views)

HAL and MAL (Hardware Abstraction Layer and Measurement Abstraction Layer) are the two obvious ones.  But generally speaking, if I have a library for something that requires more than one piece of data (ex TCP connection, queue references, etc), keeping it in a class helps protect the data from getting messed up by the user of the class (ie closing the queue outside of the class).  Inheritance is optional; protecting data is crucial.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 4
(975 Views)

As others have said, HAL and MAL.

 

One word of caution I would make is that object composition is generally preferable over inheritance for a lot of functionality.

 

Use composition where things "have" other things. Use Inheritance where things "are" other things.

0 Kudos
Message 4 of 4
(932 Views)