Jun
02

Extending LabVIEW-built applications with LVOOP plugins

by Tomi Maila, Jun 2, 2008 at 8:27 am
1 Star2 Stars3 Stars4 Stars5 Stars (4 votes, average: 5 out of 5)
Loading ... Loading ...

There are numerous reasons why you would like to allow your LabVIEW application to be extended with plugins. First you may want to allow your customer or a third party to add some new functionality to your application. LVOOP plugins provide a way for you to allow third parties to extend your application. Second you may want to separate the built and development process of the core application from the development process of the features of the applications. With OOP projects LabVIEW development environment slows down dramatically as the number of classes gets too high. It may be wise to separate your application so that only the core elements form the main application and all other elements are provided as add-on components. Third you may want to control the memory footprint of your application and specify at runtime which components are loaded into memory; there is no need to keep the code for unused features in memory. Consider for example that your application supports multiple file formats or device drivers. You can load the needed file format plugins or device drivers on demand into memory at runtime. more…

Print This Post Print This Post

Forum discussion Forum discussion

May
16

Fighting Corruption: Using Source Code Control Systems (SCC) with LabVIEW Class Files

by Omar Mussa, May 16, 2008 at 3:22 pm
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5 out of 5)
Loading ... Loading ...

I started to write this article in June 2007 and a recent post on LAVA made me realize that it may still be of use :)

National Instruments (NI) has provided LabVIEW developers native OOP support (LVOOP) since LabVIEW 8.2. Users of LVOOP can quickly build single inheritance ByValue object hierarchies that are very powerful. However, there are a few corruption issues related to LVOOP that have made me realize that without SCC I would be getting nowhere on my current LVOOP project. I think these principles also apply more generically to all LabVIEW project files.

There are several hurdles that will basically ruin your day when developing in LVOOP without a good backup system in place. SCC systems provide backup and version control for all of the files that you modify during the course of development which allows you to revert your code to a known state when your files get corrupted. SCC systems basically allow you to take snapshots of your project so that you can revert your code at a very granular level should the need arise. Using SCC should be important to anyone who wants to be able to work on code which means this document applies to solo-developers and not just people working on development teams. There are no excuses for not using an SCC system!

more…

Print This Post Print This Post

Forum discussion Forum discussion

May
07

Tomi’s NIDays 2008 Presentation

by Tomi Maila, May 7, 2008 at 12:01 am
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

NI Days logo
I’m giving a presentation on LabVIEW Object-Oriented Programming at NIDays 2008 in Helsinki today. The presentation is titled Software Development with LabVIEW Object-Oriented Programming. The slides for the presentation as well as the presentation related example application can be downloaded below.

Download NIDays 2008 Presentation Slides


Drawing Tool 1.0

604.7 KB
You must be logged in to download this item!
Please login or register now.

Discussions in English | Finnish

Print This Post Print This Post

Forum discussion Forum discussion

Jan
07

Recursive Data Types in LabVIEW - making recursive data structures type safe

by Tomi Maila, Jan 7, 2008 at 4:15 pm
1 Star2 Stars3 Stars4 Stars5 Stars (4 votes, average: 5 out of 5)
Loading ... Loading ...

LabVIEW Object-Oriented Programming (LVOOP) was introduced in LabVIEW 8.20. LVOOP allows developers to build recursive tree-like data structures within LabVIEW dataflow model. Recursive data structures are enabled by allowing class private data members to be of ancestor class type. As ancestor class private data members can hold descendant class objects, recursive data structures are possible.

However LabVIEW doesn’t allow using recursive type structures where a type refers to itself. I present here that indeed building such types would be possible within the dataflow framework of LabVIEW. Such recursive types would allow building recursive data structures in more intuitive and type safe manner than what is possible with current LVOOP implementation.

more…

Print This Post Print This Post

Jul
23

LabVIEW Object-Oriented Programming Introductory Walktrough

by Tomi Maila, Jul 23, 2007 at 6:01 pm
1 Star2 Stars3 Stars4 Stars5 Stars (9 votes, average: 4.78 out of 5)
Loading ... Loading ...

LabVIEW Object-Oriented Programming, or LVOOP for short, has been around for about a year now. Have you had time to take a look at it? If not, it’s about the time. I made you a short video on the very basics of LVOOP development process. It doesn’t go into details of inheritance and all that but it gives you and idea on how to get started. So get yourself a cup of coffee, sit down comfortably, and press the play button.


(length 09:05)

Print This Post Print This Post

Jun
12

Concepts Behind OpenG Class Templates

by Tomi Maila, Jun 12, 2007 at 10:09 am
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Yesterday the OpenG Class Template Framework together with a few OpenG class templates were released. I now try to explain shortly what these templates actually are and how do they function.

OpenG Class Templates are nearly normal LabVIEW classes that are stored under resource\OpenG\openg_object\class_templates folder under LabVIEW installation directory. To be used OpenG Class Templates require a separate tool that can create new classes from the templates and that can manipulate existing classes created from class templates.

The class file of LabVIEW classes is always an XML file with information of class properties, class private data and class item properties. OpenG Class Templates differ from regular LabVIEW classes in that additional information is added to the lvclass XML file of the templates. This additional information explains the template tool such as Endevo GOOP Development Suite how to work with the templates. Based on this additional information the template tool knows how to create new classed based on the templates, how to create new methods from method templates, how to rename class based on a template and how to update template changes to template based classes.

When user wants to create a new class that is based on a OpenG class template, he needs to do this via a tool that support OpenG class templates. In the process, the tool creates a copy of the template and manipulates the copy according to the template meta data written in the template XML file. The tool also adds additional attributes to the class file created from the template so that this class can be recongnized to be based on a tempalte and the template used can be located. When there are changes in the template, these changes can be applied to the classes based on the template using this metadata in the class files.

As the templates are more or less regular LabVIEW classes, they can also depdend on other templates in a very similar manner as LabVIEW classes inherit from parent classes. For example OpenG Active Object Template is based on OpenG Reference Object Template. Active object is actually a referece object with some extra features and with a few changes in some underlying mechanisms. The inter-template dependency means that changes to parent templates can propagate via the child templates to classes created from the templates. This of course requires support from the tool being used.

The tools that support OpenG Class Template specification should be able to recognize any template in the above mentioned template directory. This makes it possible for the developers to create their own class templates specific to their own needs. However OpenG Class Template specifications are quite complex yet capable and it is not very easy to create new class templates. The complexity of the template mechanism also means that it’s probable that in the beginning only tested templates will work with tools supporting OpenG Class Templates and actually the support for custom templates will see light only when the tools get more mature.

Print This Post Print This Post

Jun
11

OpenG Class Templates public beta & Endevo GOOP Development Suite released!

by Tomi Maila, Jun 11, 2007 at 11:00 am
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5 out of 5)
Loading ... Loading ...

For the past few months I’ve been working on a very interesting project together with Endevo from Sweden with Jim Kring from JKI. I have had the opportunity to design open source OpenG Class Templates for LabVIEW Object-Oriented Programming. Endevo has developed a GOOP Development Suite that allows developers to create classes from these OpenG templates directly from LabVIEW user interface. OpenG templates together with Endevo GOOP Development Suite has the potential to fundamentally change the LabVIEW object-oriented development process.

Creating and closing an object in OpenG Reference Object Template based class

OpenG Class Templates

When LabVIEW Object-Oriented Programming was released about a year ago, I had a lot of expectations. Unluckily the features of LabVIEW OOP didn’t meet with my development needs. I needed by-reference classes to be able to represent complex data structures and encapsulate storage interface to classes. I needed user definable constructor and destructor for my classes to guarantee initialization and clean-up. With these needs I started to think of the ways how I could best implement these features on top of native LabVIEW OOP.

The aim of the OpenG Class Templates is to overcome the above mentioned shortcomings of native LabVIEW object-oriented programming by including features lacking from native LabVIEW OOP to OpenG class templates. Two most interesting OpenG templates are without doubt a queue based by-reference class template and a class template for active asynchronous objects.

Queue based by-reference class template allows developers to create by-reference classes with user defined object construction and destruction steps and with asyncrhonous parallel data access and data locking. By-reference classes are the proper choice when one needs to create objects with indentity and lifetime. Numerous use cases include encapsulation of instrument drivers, file handling, database access, network interface and urser interface components.

Template for active asynchronous objects combine by-reference objects with a thread of their own. Each object includes a parallely executed VI that is started during object construction and closed when object is closed. This parallely executed VI can receive and reply-to asyncrhonous messages from other parts of the program. Active objects can be considered to provide an active state-machine based service that other parts of the program or external components can communicate with using the object methods.

OpenG class templates are based on OpenG class template specifications. These specifications define a standard which allows all developers to create new class templates either from scratch or based on existing class templates. Furthermore developers can use these templates with any LabVIEW tool that confroms with the template specifications. Currently the only tool available is Endevo GOOP Development Suite.

OpenG wiki provides instructions on how to get and install OpenG class templates.

Endevo GOOP Development Suite

Endevo GOOP Development Suite (GDS) has an opportunity to revolutionize LabVIEW object-oriented programming based development. Being integrated directly to LabVIEW project environment Endevo GDS makes it very easy and fast to work both with native LabVIEW classes and with template based LabVIEW classes. The speed-up of the development process is actually enormous when the development suite takes automatically care of things like creating method icons etc.

Endevo GOOP Development Suite supports three kinds of classes; native LabVIEW classes, classes based on OpenG templates and classes based on Endevo templates. All of these alternatives are based on native LabVIEW object-oriented programming. Actually Endevo GDS allows users to create and add their own class templates that meet OpenG class template specifications.

GOOP Development Suite comes in two editions, limited functionality free Community Edition and in Professional Edition. Both versions of GOOP Development Suite can be downloaded directly from Endevo web site.

Conclusions

OpenG Class Templates together with Endevo GOOP Development Suite have a lot of potential to change the way LabVIEW object-oriented programming is beign used. I’ll keep blogging on the usage the templates. Subscribe to the feed not to miss any of these future articles.

Print This Post Print This Post

May
14

Scala, my favorite non-visual programming language

by Tomi Maila, May 14, 2007 at 6:56 pm
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Scala logoScala is my favorite non-visual or text-based programming language. Scala is a functional object-oriented programming language has succeeded to combine almost all features I’d like to see in a programming language except the visual way of coding. Scala compiles to Java Virtual Machine and is fully interoperable with Java code. There was a nice introductory article on Artima a few days ago First Steps to Scala by Bill Venners, Martin Odersky and Lex Spoon. If you are into text-based programming, you should seriously take a look at this article.

Print This Post Print This Post

Apr
27

Object-flow Programming - Merging Dataflow and Object-Oriented Programming

by Tomi Maila, Apr 27, 2007 at 4:45 pm
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

I was giving a talk on LabVIEW object-oriented programming a few week ago in the local LabVIEW user group in Helsinki. For the talk I did some research on the roots of dataflow programming and the roots of object-oriented programming. According to a Wikipedia article I found, dataflow programming was introduced in Bert Sutherland’s Ph.D. thesis, The On-line Graphical Specification of Computer Procedures in 1966. Coincidentially the first object-oriented programming language Simula 67 was introduced around the same time.

History of Dataflow, LabVIEW and Object-Oriented Programming

Now these two different programming paradigms are merging and giving birth to a new paradigm object-oriented visual programming or should I call it object-flow programming. I believe this to be just the beginning of a new phase in the evolution of visual programming; we’ll see a lot of innovation in this field for the years to come.

Multi-core processors force the software industry to seek solutions to the development of parallel application. Object-flow programming makes developing parallel programs easy. Text based programming languages are bug-prone; visual software development is much less so. Object-flow programming has all the means of doing the same for programming as what Microsoft Windows did for operating systems -making programming so easy and intuitive that it’s no longer a privilege of few.

What do you think? Do you agree with me on the future opportunities of object-flow programming? What do you see to be the greatest obstacles? Could National Instruments get object-flow programming to Forbes cover page or do we need some other company to take the lead? I’d love to hear you comments!

Print This Post Print This Post

Apr
14

Reusing Code by Inheritance

by Tomi Maila, Apr 14, 2007 at 8:45 pm
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 4 out of 5)
Loading ... Loading ...

In our last topic in article series Introduction to Object-Oriented Programming in LabVIEW I explained how real world objects form conceptual hierarchies. This concept of hierarchies is also present in object-oriented programming where building block can have hierarchical relationships. This concept of hierarchical relationships of software modules in object-oriented programming is called inheritance, as explained last time.

Inheritance in practice

So what does inheritance practically mean in the context of object-oriented programming? Why would we like to define class hierarchies?

Let’s first define some concepts. When a class inherits from another class we call the class upper in the hierarchy a parent class and the class lower in the hierarchy a child class. Further we call parent, parent’s parent and all other classes up in the inheritance chain ancestor classes. Likewise we call all classes down the inheritance chain descendant classes. In the picture below these concepts are visualized for the class Car.

Terminology in LabVIEW object-oriented programming

As we explained earlier a class in object-oriented programming is a user defined datatype that encapsulates both data and functionality. In comparison conventional LabVIEW data types only carry data. As classes are types in object-oriented programming, wires of class types are called objects.

Each class in object-oriented programming specifies some functionality. To implement this functionality the class developer writes a set of method VIs. The method VIs are an integral part of the class. In addition the class developer specifies some internal or private data type for the class. This data type is a cluster. Note that the unlike conventional clusters, this cluster can also be empty.

Reusing ancestor methods

So what’s all the fuss about inheritance? Inheritance allows a developer of the descendant class to reuse much of the code in any of the ancestor classes. If an ancestor class has a method public method VI, this method is available also in any of the descendant classes. Furthermore if objects of ancestor class carry data of certain type, then all the descendent classes carry similar data of the same type.

Let’s take an example. Consider a land vehicle class. As each land vehicle has wheels, we decide to specify that a land vehicle class cluster of private data is an array of wheels. Cluster of private data is a place where the developer specifies the data type that is carried by the wire. Now our all objects of Land Vehicle class as well as all objects of any of the descendant classes of Land Vehicle would carry array of wheels as private data. In addition descendant of Land Vehicle can carry other private data as well but they would always carry at least an array of Wheels.

We cannot fix the number of wheels as some vehicles such as bicycle has only few wheels and others such as a train have more wheels. Further we cannot add an engine to cluster of private data as not all land vehicles have engines. The picture below illustrates the private data of our Land Vehicle class.

Private data of Land Vehicle class

Now we define a public method VI Add Wheel.vi to Land Vehicle class. This method would add a wheel to a vehicle. Now each descendant class of class Land Vehicle would also have these two methods automatically. Land Vehicle would be a kind of a template or a starting point from which we can now build different kinds of land vehicles such as a car or a bicycle.

VI interface of Add Wheel.vi


Class Land Vehicle is a parent class of classes Car, Bicycle and Motorcycle. Now comes the interesting part. All these three classes can call the Add Wheel.vi method as if it was their own. The picture below illustrates this ability.

Add Wheel

So by inheriting classes Car, Bicycle and Motorcycle form a common parent class Land Vehicle, we can share code related to adding wheels to different kind of vehicles between these three classes. The same generality cannot be achieved in classic dataflow programming with such an elegant way.

Passing descendant classes as arguments

Consider you want to travel from Paris to Berlin. Unless you want to walk, you would need a vehicle to take you to Berlin. However it could be an aircraft, a land vehicle or even a watercraft. So generally you could say that any vehicle could be used to travel from Paris to Berlin.

Similar way thinking can be applied to object-oriented programming. When any VI expects an input of general class type then any of its descendants can be passed as an argument as well. So should you have a VI Travel by Land.vi that expects an object of class Land Vehicle as an input, you can pass any object of any descendant class of class Land Vehicle as an argument. This is illustrated by the following picture. The VI expects a Land Vehicle (right) and we pass a Car which is a child of Land Vehicle (left).

Travel by Land

In the previous example we showed how we can reuse ancestor method VIs in descendant classes. However this is not the only benefit of inheritance and class hierarchies. In addition to reusing ancestor class code, we can also pass descendent classes as arguments where ancestor class is expected. Alternatively we can create an array of different kinds of Land Vehicles as select one of the items in an array using index array.

Travel by Land with array of objects

Conclusions

In LabVIEW object-oriented programming or LabVOOP for short we developers can share parent or other ancestor class code between all the decedents of that class. This is a great benefit when software components with shared properties are needed. In my next article in this series I’ll talk about class interfaces, how the interfaces can be shared between classes in the hierarchy and how this greatly enhances software development process. Subscribe to the RSS feed of this blog not miss it.

Print This Post Print This Post