10-27-2009 03:29 PM
Local variables are bad, but you can still get a bad result using constants. Run this.
10-27-2009 03:40 PM
Ray.R said:
Scary!
There's some Rube Goldberg as well. Especially repeating the cluster info from the left to the cluster at the right. AND to populate data from one cluster to a bunch of Locals.. Why bother having a cluster!!
This code is scary all right. Many of the block diagrams take up 6-8 screens. Lots of hidden indicators. Just an absolute nightmare to try and figure out. The worst part is I'm pretty sure it was written by an Alliance Partner.
10-28-2009 07:35 AM - edited 10-28-2009 07:37 AM
It's possible that it was written by an Alliance Partner.
I once (last LV contract I did) reviewed code written by someone who claimed to be a Certified LabVIEWArchitect, until I checked the listing on this website and asked the guy what he meant by that. I soon discovered that he took all the training from Basic 1 to Advanced Architectures, thus automatically making him an expert. The code was so bloody horrible, it wasn't funny. I learned to walk away from those contracts. They want you to fix someone elses mess for free. When we walk away those peoplecry that we are letting them down. - gee -
The problem is that people are not educated about the difference between a true expert and people that claim expertise. And they do not want to be educated, they want to believe that it takes 5 minutes to be an expert at LabVIEW cause it's already all done for you. Now where do they get such BS??
(was I ranting? ) 😉
LOL!
Broken Arrow..
I'll have to try your code.
By the way, how do you add LV2009 code snippet into your post? I might have 1 day left on my evaluation LV2009.
10-28-2009 07:48 AM
Ray.R wrote:By the way, how do you add LV2009 code snippet into your post? I might have 1 day left on my evaluation LV2009.
Hope you know how to make a snippet image. (Select the portion of Block Diagram you want to take a snippet and select "Create VI Snippet from selection" from the Edit menu. Save it as a png file. Now in the composer tool bar, select Upload or insert an image. That's it. Give the path from your computer and you are done.
10-28-2009 07:55 AM
Wayne.C wrote:Tip (ical) of the iceberg. This app that uses hundreds of local variables and upwards of 100 global variables to boot.
Message Edited by Wayne.C on 10-27-2009 01:40 PM
I'm going to play devli's advocate with this one.
Don't like the gloabl read in the first frame so no suprise there, but with that exception there some reasons to see code like that.
THat code looks like a dialog screen where the FP controls are initialized in the first frame. Since locals are more efficient than property >>> value nodes and the diagram is smaller, I'm OK with those.
In the last frame we are gather up the users final settings, so I'm OK with those.
Inside the event struture, I can only comment on what I see. It looks like we could have just used the "rated HP" instead of the local read, yes. But, if this event was created by duplicating another event frame, then the use of locals is valid for a lazy developer (like me). When duplicating an event (or case) with controls, new control will be placed on the FP. If you do the same with an event with locals, you will get duplicates of the locals.
By placing the control in the event structure, a developer can double click on it on the GUI and quickly find in which event that control is used.
Just trying share some other ways of looking at that.
Ben
10-28-2009 08:03 AM
(was I ranting? )
Maybe just a little. We can't have you bottling up all that stress now can we?
Unfortunately in this case I can't 'run away'. This is part of a production tester in one of my employers other facilities. I normally stick to stuff for the engineering lab but I seem to be getting sucked into the into the production side as well.
P.S. Kudos for the avatar. Maybe we need to hand out some awards for holiday decorating?
10-28-2009 08:45 AM
I'm going to play devli's advocate with this one.
Ben,
I see your point about the efficiency of updating the front panel. I'm usually in RT Target mode and write that code like front panel indicators don't exist. I posted this vi because it is one of the few that will fit on a single screen.
10-28-2009 08:52 AM
Wayne.C wrote:
Ben wrote:
I'm going to play devli's advocate with this one.
Ben,
I see your point about the efficiency of updating the front panel. I'm usually in RT Target mode and write that code like front panel indicators don't exist. I posted this vi because it is one of the few that will fit on a single screen.
I understand and my comments were not intended to call into question your knowledge. I was just making sure this thread never becomes a citation indicating why some of my delivered code is bad.
Re-writing that code to reduce the locals to one or none would result in code that is much harder to understand.
But that global on the left and the lack of a type-def going out still makes me question the app as a whole.
Ben
10-28-2009 09:59 AM - edited 10-28-2009 10:00 AM
Ben,
No apology needed. Actually, my lack of knowledge is often why I'm on the forums. In this case you pointed out a situation where the use of locals can be justified. Time to go back an re-evaluate the programer's use of locals in the rest of the program and see if a pattern emerges.
Here is example of the real headache.
10-28-2009 10:16 AM - edited 10-28-2009 10:19 AM
Wayne.C wrote:Ben,
No apology needed. Actually, my lack of knowledge is often why I'm on the forums.
In this case you pointed out a situation where the use of locals can be justified. Time to go back an re-evaluate the programer's use of locals in the rest of the program and see if a pattern emerges.
Here is example of the real headache.
Message Edited by Wayne.C on 10-28-2009 11:00 AM
Please note that the graders of the CLD and CLA do not read my posts and do NOT share my thoughts.
RE: that image
You don't have to support that code do you? If it works I am suprised and if it does work, that is only until something gets changed.
That code is just plain painful to look at.
Ben