LabVIEW Object-Oriented Programming FAQ
Overview
The following are answers to frequently asked questions about LabVIEW object-oriented programming.
Benefits of Using LabVIEW Object-Oriented Programming
1. What is object-oriented programming (OOP) in general and why use it?
Object-oriented programming has demonstrated its superiority over procedural programming as an architecture choice in several programming languages. It encourages cleaner interfaces between sections of the code, it is easier to debug, and it scales better for large programming teams.
From Wikipedia:
The idea behind object-oriented programming is that a computer program may be seen as comprising a collection of individual units, or objects, that act on each other, as opposed to a traditional view in which a program may be seen as a collection of functions, or simply as a list of instructions to the computer. Each object is capable of receiving messages, processing data, and sending messages to other objects. Each object can be viewed as an independent little machine or actor with a distinct role or responsibility.
Object-oriented programming is claimed to promote greater flexibility and maintainability in programming, and is widely popular in large-scale software engineering. Furthermore, proponents of OOP claim that OOP is easier to learn for those new to computer programming than previous approaches, and that the OOP approach is often simpler to develop and to maintain, lending itself to more direct analysis, coding, and understanding of complex situations and procedures than other programming methods.
2. What are the differences between OOP in C++ and LabVIEW?
C++ is a text-based, functional language. LabVIEW is a graphical, dataflow language. The different paradigms require differences in how they present OO features:
- LabVIEW has an ultimate ancestor class for all objects. C++ does not.
- C++ has constructors. LabVIEW has no need for them.
- C++ has destructors. LabVIEW has no need for them.
- C++ has both a reference and value syntax for passing objects as parameters. LabVIEW has a value syntax only, with references created through other features.
- LabVIEW has automatic data mutation so the user can retrieve old data even if the class has been edited. C++ does not, requiring the user to track version changes and write mutation code for data.
- C++ has templates. LabVIEW does not.
- C++ has pure virtual functions. LabVIEW 8.2 and 8.5 does not. In LabVIEW 8.6, LabVIEW added the Must Override option for dynamic dispatch VIs which handles one of the two major use cases for pure virtual functions.
- C++ has multiple inheritance. LabVIEW has single, public inheritance.
Reader Comments | Submit a comment »
LabVOOP Design Patterns
Information about basic design patterns with
LabVOOP may be found here:
http://forums.ni.com/ni/board/message?board.id=170&message.id=216094&requireLogin=False
- Stephen Mercer, National Instruments. stephen.mercer@ni.com - Aug 3, 2007
LVOOP Forum
If you want to discuss more about LabVIEW
Object Oriented Programming, please visit the
LAVA Forums here:
http://forums.lavag.org/index.php?showforum=68
- Michael Aivaliotis, James Kring Inc.. michael.aivaliotis@jameskring.com - Oct 27, 2006
Legal
This tutorial (this "tutorial") was developed by National Instruments ("NI"). Although technical support of this tutorial may be made available by National Instruments, the content in this tutorial may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this content with each new revision of related products and drivers. THIS TUTORIAL IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).
