09-20-2016 09:42 AM
Greetings!
This post could easily be sub-titled "I Have A Sneaking Suspicion I've Written This VI Before!", and that gets to the heart of the problem I'm trying to solve. I am looking for input for the best means of organizing code, be it an existing code base or a large project. I have to deal with both, as I'm the sole LV developer in my group and the primary "NI guy" in the company. Most of what I'm working on lives in a single (very large) project, but I have other, smaller projects as well. I use TortoiseSVN for version control, but that doesn't really seem to give me a means to keep track of the code I've written. Because of the nature of my job, I tend to work on various projects in fits and starts, sometimes with lengthy gaps between coding sessions. This has led to many instances of me re-writing a function because I couldn't quickly locate the original.
I can't be the only developer with this problem, so I'm hoping someone out there has found some sort of code organization strategy or tool that I can try.
Thanks!
09-20-2016 09:52 AM
Are you using other programming languages like ANSI C or C#?
If yes: How would you solve it there?
Remember that LV is also a programming language. So everthing concerning Software Engineering and most of coding practices also applies here.
That being said, i can imagine that you will find the print tool quite useful (Edit >> Print). It can create screenshots of your code for documentation purposes automatically. Also, you might want to look into the VI Package Manager for documentation tools. The LV Tools Network is also a valid source (similar to the VIPM).
09-20-2016 10:07 AM
No, I don't program in any other languages, at least not enough to have an established mindset for solving this type of issue. I've not considered using using the print tool in the manner you described, but I'll look into it and into VIPM. Thanks!
09-20-2016 10:09 AM
As far as code organization, it is mostly making good use a structured libraries and directories. Do you not do the same for any documentation you have to maintain (build of materials, schematics, work instructions, etc.)?
09-20-2016 10:30 AM
Here are a few tips:
1) Use lvlibs to create libraries to reusable code - when you have a few VIs that perform a similar function (e.g. logging VIs, data manipulation VIs) then create an lvlib and put them there. Organise the lvlib and it's VIs to be in its own folder (that way it's super easy to move/copy that library around without any weird dependencies)
2) Of course, you should be using source control and that goes for your re-use libraries too.
3) For sharing your reuse code between projects, you can either create an SVN repository containing the VIs which you then check-out to your LabVIEW folder (e.g. vi.lib / user.lib) or learn how to use VIPM to create VI packages which you can use to distribute/install your shared code. I prefer the VIPM route as it works better when you come to change LabVIEW version, you simple reinstall the VI package in the new version of LabVIEW.