JKI Blog

#5 Best Practice for using the JKI State Machine: Left-justify State Strings

Jan 13, 2016 6:00:54 AM Published by Jim Kring Leave a comment
2016-01-08_18-45-17.png

In my last post on JKI State Machine Best Practices, I explained the #4 Best Practice: Use macros (instead of “chaining” together sequential states).

In this post, I'll talk about a very simple (yet important) best practice that will help make your code much more readable for you and others who work on or inherit your code.

The #5 Best Practice: Left-justify State Strings

I said this one was simple, right?

Left-justified text -- easy to read.
Left-Justified State String

Right-justified text -- hard to read.
Right-Justified State String

With left-justification, as you can hopefully see, it's much easier to read the category headings/groupings for multi-line (multi-state) strings.

One quick tip to ensure you get a left-justified string constant is to copy the "Macro: Initialize" string constant (that's outside the JKI State Machine on the left-hand side) and use that as your starting point, as shown below.

copy+paste macro init

We’d like to hear about your best practices for using the JKI State Machine. Please post comments and suggestions, below.  And, if you have ideas for making the JKI State Machine better, please post them to our Idea Exchange.

And a note from our sponsor: At JKI we use the JKI State Machine every day to help our our clients get their innovative high-tech products and technology to market fast. If you need help taking your system software to the next level or reach an important milestone, contact us to learn more about our services.

Tags: best practices, JKI State Machine, LabVIEW, LabVIEW tip, JKI State Machine, state machine

Subscribe to Email Updates

Recent Posts

Posts by Topic

see all