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.
Right-justified text -- hard to read.
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.
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 the JKI State Machine GitHub Issue Tracker.
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.