LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
AristosQueue (NI)

Add option to Diagram Cleanup for converting all stacked sequences to flat sequences

Status: New

I am filing this idea on behalf of a customer who talked to me about a VI he had been hired to refactor. One of the hardest parts of that VI to understand was all the sequence locals on the border of stacked sequence structures that made the wires run right-to-left. He created a scripting tool to convert all the stacked sequences. This lead to the idea that the Tools >> Options settings for Diagram Cleanup could include another option:

[    ] Convert stacked sequences to flat sequences

It would default to unchecked when LV ships, but users could enable it when doing certain types of refactoring. When the option is enabled, any stacked sequence that gets included in a diagram cleanup would be converted to a flat sequence.

10 Comments
altenbach
Knight of NI

Might really blow up the diagram with stacks and stacks of stacked sequences as we sometimes see. 😮

Still, it could be helpful.

jcarmody
Trusted Enthusiast

@Aristos Queue wrote:

[...] He created a scripting tool to convert all the stacked sequences. [...]


That would be interesting to see <hint> <wink>.

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

Wart
Member

Can't you already right click on a stacked sequence and replace it with a flat sequence?

altenbach
Knight of NI

> Can't you already right click on a stacked sequence and replace it with a flat sequence?

 

The idea is that the cleanup button should do that automatically for all existing stacked sequences.

Darin.K
Trusted Enthusiast
I am sure that this seems like a good idea to that person, but I think it would be a nightmare for someone refactoring code. On a good day with clean code the BD blowup tool will wreak havoc and vengeance upon you. When I refactor code, I want to change things in a controlled manner, and this would mean blowing up the structures one at a time. I have only dabbled with the conversion and I have still seen train wrecks. I can't imagine seeing a dozen of these things explode at once. On second thought, that sight would probably scare me into dumping the code instead, maybe not a bad result.

 

Another thought, perhaps it is time to add shift registers instead of the nasty sequence locals. It would clean up the code in the short term, and then provide a vehicle to eliminating them. It would be efficient to use for real sequences, but also very easy to convert to a traditional state machine or case structure.
tst
Knight of NI Knight of NI
Knight of NI

>...Another thought, perhaps it is time to add shift registers instead of the nasty sequence locals.

 

I agree, but it looks like this wasn't very well received - http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Stacked-Sequence/idi-p/918243

 


___________________
Try to take over the world!
X.
Trusted Enthusiast
Trusted Enthusiast

Sounds like a bad idea for all the reasons above... plus I thought the LV dvpt team was against multiplying options?

Who is using the diagram cleanup tool anyhow (somebody said masochist)? Smiley Very Happy

SteveChandler
Trusted Enthusiast
I like it because I get to refactor lots of interesting fun. This adds another tool to the reafactoting toolbox, which, I might add, is woefully lacking. Besides it is an option that you have to explicitly set so it should do no harm. As for "new users" that people seem to constantly try to protect, they usually do not go mucking with these types of settings. If they find this one it will serve as a clue that stacked sequence structures are something that need to be "cleaned up". There are other ideas here that I would not want to see sacrificed for this one. But if it can easily be implemented then it should be.
=====================
LabVIEW 2012


AristosQueue (NI)
NI Employee (retired)

> Who is using the diagram cleanup tool anyhow (somebody said masochist)?

 

Darren Nattinger and myself use it extensively on all VIs we write these days. It's become something of a rule-of-thumb for me -- if a VI after diagram cleanup doesn't *look* clean, that probably means I've loaded that VI up with too much complexity and refactoring it is a good idea rather than just cleaning up the G code. I've been amazed at how well that heuristic applies. Sometimes I stick with the VI and do the manual cleanup anyway, but it still gives me good guidance for functionality breakdowns in my architecture. And if a simple VI doesn't look clean, well, that's a bug report I file, and the diag cleanup tool keeps getting better every release.

johnsold
Knight of NI

I dislike the idea of having Diagram Cleanup changing the code.  Leave that to the developer.

 

The pop-up option to convert to flat sequences is sufficient.  The developer has control over what gets changed.

 

I like AQ's suggestion that Diagram Cleanup is a quick quality check on the code.

 

Lynn