05-27-2011 05:14 PM
05-27-2011 05:41 PM
@CMal wrote:
On the subject of scary images, LabVIEW was recently honored by an article on thedailywtf.
Chris M
Unfortunately people are taking an example of extremely bad code and using that to bash LabVIEW. When I have some time I will need to reply to some of the ridiculous posts over there.
Thanks for the heads up.
05-27-2011 05:45 PM
@CMal wrote:
On the subject of scary images, LabVIEW was recently honored by an article on thedailywtf.
See also Yair's post from ~10 days ago.
05-27-2011 07:21 PM
@Mark Yedinak wrote:
@CMal wrote:
On the subject of scary images, LabVIEW was recently honored by an article on thedailywtf.
Chris M
Unfortunately people are taking an example of extremely bad code and using that to bash LabVIEW. When I have some time I will need to reply to some of the ridiculous posts over there.
Thanks for the heads up.
05-28-2011 09:12 AM
@SynergyMike wrote:
Ok, now you have my curiousity piqued... in LV7 code that I took over, I found numerous instances where, in order to test for the existance of a directory or file, the error cluster was used. In order to preserve dataflow, I added a clear error to each instance of a case structure that had selected the error - is there a preferred alternative? (The VI probably has 5 or 6 clear errors total).
Michael Tracy
Synergy Microwave
Legacy code get grandfathered out of modern expectations but there are functions on the Files Advanced palette to list check etc.
To judge my own rules I tend look at a software developers relationship to their code as analogous to a doctors relationship to their patient. To evaluate the current state, the doctor will probe and look for specific conditions and/or reactions. A patient recoiling when the abodmen is probed could indicate a specific ailment while attempting to open the file the user specify returning an error 7 File not found, or parsing a binary file and check from error 4 EOF are specific checks for conditions that we expect will happen. The attempt to do the operation followed by the observation are a valid methodology. Of course pulling out that ultrasound scanner instead of poking is a better approach as is using the functions on the advanced palette that check it the file exist.
I prefer the more elegant approach when I am aware it exist and it is available.
Extending the anaology...
But using the "Clear Error" is not a specific probe. It would be like a doctor treating an in-grown toenail by cutting the nerve and telling the patient to go about their life as normal. The code construct of "Clear Error" followed using the data downstream just feels like cut the nreve and go on situation.
Full Disclosure time!
In my Control Ref Nugget I used a similar construct but rather than using the Clear Error function, I used a Case Structure selector to handle the error returned when the class was wrong. For the sake of that Nugget, it was acceptable since it would have introduced more complexity to an already complex subject. But I digress.
So Using Clear Error is not malpractice. Over use on the other hand if not abusive should give any careful developer reason to investigate (In my case shiver and fear for the sake of my patient not knowing what kind of gangreenous growths I will find inside the extremities).
But that is just my 2 cents and I admit that I have an analretentive side and the control freak in me wants it to be "error free" and as Christian mentioned above, "Is it really 'Error Free' ?".
Re: 31 instances!
That is beyond scarry. Are you being punished for something?
Ben
05-29-2011 01:24 AM
Sorry. 11, 31 or 291 uses of the clear errors VI are not a problem in themselves. You need to see how they're used in the context of the code to see if that usage was reasonable (although I admit I would probably be concerned if I saw 291).
@Mark Yedinak wrote:
When I have some time I will need to reply to some of the ridiculous posts over there.
Please don't. Like I said in the other thread, it seems to finally be dead and some of those posters didn't prove to be particularly adept at actually listening to what other people have to say. Jim's comic (one of my favorite XKCD's) sums it up nicely.
P.S. Of course, the images from here can also count as scary LV code.
05-29-2011 01:41 AM
@tst wrote:
Sorry. 11, 31 or 291 uses of the clear errors VI are not a problem in themselves. You need to see how they're used in the context of the code to see if that usage was reasonable
Ageed. After you examine the context.
This thread is all about scary images. When you do a search and find 291 Clear errors and you DON'T know what is the context, its scary.
Is there a story that goes with the number 291?
Ben
05-29-2011 02:34 AM
@Ben wrote:
Is there a story that goes with the number 291?
No.
05-29-2011 08:54 AM
@tst wrote:
Sorry. 11, 31 or 291 uses of the clear errors VI are not a problem in themselves. You need to see how they're used in the context of the code to see if that usage was reasonable (although I admit I would probably be concerned if I saw 291).
You are right. Without going into how they are used let's just say that at one point the code with 31 clear error vis had over a hundred calls to the abort function. It doesn't anymore because I wrote a vi with nothing but the abort function in it and did a search and replace so now there is only one. My thought is that now I have a vi where I can do the software equivalent of deploying an airbag before the car hits the tree.
05-29-2011 08:57 AM
Did it also watch the clock so that it did not work past quitting time?
Lynn