LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Case structure not working for string

Solved!
Go to solution

I'm curious about that poster's comment under #2 where they they claim that one particular block diagram was better than the other.  He said the one using string commands was simpler than the one with enum commands.  Those two block diagrams looked pretty equivalent to me.  They had exactly the same number of components.

 

I think he made a number of valid points about advantages of using strings, but I still prefer enums for the reasons that Ben gave.  But a comment about one diagram being better than the other when it obviously isn't tends to discredit that person in my eyes just a little bit.

Message 11 of 18
(967 Views)

@RavensFan wrote:

Those two block diagrams looked pretty equivalent to me.  They had exactly the same number of components.


Yup totally agree with that one.  Those that know enough about the subject (on both sides) can argue either side because they know it well enough.

Message 12 of 18
(964 Views)

@Hooovahh wrote:

@RavensFan wrote:

Those two block diagrams looked pretty equivalent to me.  They had exactly the same number of components.


Yup totally agree with that one.  Those that know enough about the subject (on both sides) can argue either side because they know it well enough.


After looking again I believe that I have posted counters to all of the points made in that blog. I should not be too hard on him first because stepping out and sharing those thoughts is a noble effort. Secondly because I have made a living from rewriting code that was developed with many of those features that ended up blowing up once it was scaled up.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 13 of 18
(958 Views)

I do not like talking behind someone's back so I replied to that blog with some links that I think could be helpful and invited him to resume the conversation here on the NI forums.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 14 of 18
(941 Views)

Hello everyone,

thank you very much, and especially to 

 

 

 

@RavensFan wrote:

I'm curious about that poster's comment under #2 where they they claim that one particular block diagram was better than the other.  He said the one using string commands was simpler than the one with enum commands.  Those two block diagrams looked pretty equivalent to me.  They had exactly the same number of components.

 

 

But I understand this topic from another point of view, and I realize all benefits of enums also. Just, in that post I expressed my thoughts about this topic, and I'm really very happy that you gave me feedback to it.

 

Sincerely, kosist90

 

logos_middle.jpg

 

JKI VI Tester – useful tool for LabVIEW developer

0 Kudos
Message 15 of 18
(862 Views)

I think of strings vs. enums another way.  Most of us have probably seen these things (or something similar) somewhere before in real life:

Sorted trash.JPG

 

Look in one of those in a small office setting, and everything is sorted.  But look at one in a public park, and everything is just crammed in everywhere and you may as well not have bothered.

 

As such, I feel that strings work fine if it's private code created and maintained by one person, but if you have a team of designers or if you're going to be inviting the general public to use your code then enums are the way to go, as it becomes impossible to try to enter a state that doesn't exist.

Message 16 of 18
(857 Views)

Kyle97330, thanks for your reply!

One can do mess with whatever he will use - with enums, strings, etc. If one does not structure the code, he will get mess with enums also. I know it, because I was doing it when I just started programming.

Regarding team work on the code - yes, I agree; but for nevetheless: if I'd implement public modules I'd use API for them (so others can't break internals of the module by not proper message sent); but for contribution yes, enums will be more safe then.

 

Sincerely, kosist90

 

logos_middle.jpg

 

JKI VI Tester – useful tool for LabVIEW developer

0 Kudos
Message 17 of 18
(853 Views)

@Kyle97330 - That's a pretty good analogy, but I feel like it isn't 100% accurate.  In code I post publicly, someone else is making a copy, and doing what they want.  So it is more like me setting up the bins nice and organized, then someone taking it to their home, and then shoving things in random holes instead of using it properly.  I don't really care that they screwed it up, I set soft rules in place, and it is their responsibility to use it, and test it.  

 

Then there is the fact that users aren't really anonymous.  I mean in a park I can walk up and put the wrong thing in the wrong bin and no one knows, but if a member of my team edits the code in a poor way, I have the SCC change log.  And in that case (as with the bins example) it is probably an issue of educating the user on how to properly use the bin (or how to properly use a state machine).  Anonymity and the human behavior is a fascinating subject.

0 Kudos
Message 18 of 18
(836 Views)