Introduction to Objects and Classes
Although object-oriented programming has been a standard method of software development for decades, it’s fairly new concept to most of LabVIEW developers. I start my blog with a series of articles introducing LabVIEW users to the concepts and ideas behind object oriented programming as well as to using object oriented programming in LabVIEW.
You may wonder why you should consider learning object-oriented programming. Well, there are a number of good reasons. Perhaps the most important reason why object-oriented programming has been so successful in the software industry is the fact that people are not very good at mentally managing very complex things. Object-oriented programming allows software architects and developers to divide the problem into more manageable pieces. The advantage is especially clear when working in teams. Each member of the team can concentrate on their own pieces of a complex software entity.
Object-oriented programming allows more modular software design compared to conventional dataflow programming. As a result of modularity object-oriented programming simplifies the modeling of the software architecture. Modularity also makes the software maintenance and management easier and simpler tasks. The software is more manageable throughout the entire lifecycle of the software.
Abstraction
The achieve software modularity object oriented programming relies on the concept of abstraction. The idea is that the software is divided into abstract and independent pieces that are easy to comprehend. Then the actual programming problem is solved using these abstract pieces without the need to know what happens under the hood of these pieces. The abstract pieces help programmers to describe the problem in terms of the problem and not in terms of the solution.
Whereas in traditional LabVIEW programming the abstraction is achieved using subVIs, in object-oriented programming the abstraction is achieved using objects. An object is an entity that fully describes the functionality and the state of something you want to abstract. Consider you want to abstract the concept of a car. An object car would then fully describe the functionality available in the car as well as the state of the car such as color or velocity.
In traditional dataflow programming each wire is of certain type such as a number of type DBL or a cluster composed of a string and a boolean. In a similar way in object-oriented programming in LabVIEW each object is of a certain type, or to be more specific of certain class. Classes are complete definitions of object types in a similar way as typedefs are complete definitions of traditional types.
Interface
Each object in object-oriented programming has an interface that complitely describes the functionality of the object that is available to the user of the object. In LabVIEW the interface is provided with a set of
Hiding the implementation
When projects become so large that a single person cannot be responsible for the whole project, object-oriented programming becomes a handy tool. In such projects certain developers or class developers can be given a responsibility of developing certain classes. Other developers or class users then use these classes to solve some programming problems.
The interface of the class completely determines how the class user sees the class. The class developer should hide every VI that belongs to the class but that doesn’t belong to the class public interface. The interface
Why is hiding the implementation important. Internally very complicated classes can have very simple public interfaces. Hiding the implementation also hides the complicated implementation related issues from the class user and makes the class functionality easier to understand. The interface is something that the developers can agree on before the start of the actual development work allowing developers to work in parallel. Hiding the implementation also prohibits the class user from accidentally using internal parts of the class and this way allows the class developer to change and modify the implementation later on as long as the interface VIs stay the same.
Conclusions
In this article I have discussed the ideas and concepts behind the object-oriented programming and why it is a handy paradigm for software development projects. To summarize dividing the application into abstract pieces called classes make the software projects more manageable compared to subVI level abstraction. Objects are instances of classes and classes specify the type of objects. Each class has a set of public methods called interface that is exposed to the class user. All the rest of the class internal implementation should be hidden from the class user to allow changing the class implementation throughout the lifecycle of the class.
In the next article I’ll dive deeper into the world of object-oriented programming. I’ll talk about reusing classes and about inheritance. Please feel free to comment the article. You may consider signing up to the RSS feed to stay tuned with the forthcoming articles.
Print This Post
6 Comments
Make A CommentComments RSS Feed TrackBack URL


March 20th, 2007 at 6:48 pm
Tomihey what is your email address , i wanted to ask you some stuff about LabVOOP etc… Dan
March 20th, 2007 at 7:11 pm
My address is tomi at this site (expressionflow.com).
March 22nd, 2007 at 2:01 pm
Tomi, very nice article. This is exactly the sort of material I'm looking for as an introduction to LabVOOP. I've played around with dqGOOP, and the ideas make sense (as far as objects and classes..), but what I struggle with is designing the program. Hopefully you'll address that in the future. Thanks,Chris
March 26th, 2007 at 3:55 pm
Chris, nice that you liked my article. Is there anything specific application design related issues you would like to read about?
March 26th, 2007 at 4:22 pm
Good to see you writing about LVOOP DanIm always looking for meaningful examples of what LVOOP does well today.Thanks for taking time to writeRegardsJR
March 18th, 2008 at 12:03 pm
[…] I started by introductory posts on then recently released LabVIEW object-oriented programming [1,2,3,4,5]. On May 2007 long time LabVIEW veteran Rolf Kalbermatter from CIT Engineering joined me as […]