One of my favorite development quotes is from a man names Martin Fowler. He said, “Any fool can write code that a computer can understand. Good programmers write code that humans can understand.”
There are many ways to approach the definition of “understand.” One of my favorite ways is to use a simple indenting approach. Specifically, when writing IF statements and WHILE loops I like to indent the code within the section. A few spaces of indentation will allow you to quickly scan sections to determine where an area starts and ends.
But what happens in a situation when you inherit someone else’s TurboIntegrator process, and the original coder did not use this approach? IBM Planning Analytics Workspace (PAW) offers a one-click solution that will insert the applicable indents for you.
The “Indent Script” icon will make your code more readable by indenting IF statements, nested IF statements, and WHILE loops.
Here is some sample code that does not include any indenting:
This code is somewhat hard to read since you cannot quickly define where the IF starts and ends. A single click of the “indent script” button changes the code to look like this:
Not only did PAW automatically indent the components of the IF statement, but it also created a second level of indentation associated with the nested IF.
This simple approach will allow you to make your rules easier to navigate and read when scrolling through many lines of code.
IBM Planning Analytics, which TM1 is the engine for, is full of new features and functionality. Not sure where to start? Our team here at Revelwood can help. Contact us for more information at info@revelwood.com. And stay tuned for more Planning Analytics Tips & Tricks weekly in our Knowledge Center and in upcoming newsletters!
Read more IBM Planning Analytics Tips & Tricks:
IBM Planning Analytics Tips & Tricks: PAW Workbench Go To Rule
IBM Planning Analytics Tips & Tricks: VSTACK_HSTACK
IBM Planning Analytics Tips & Tricks: Slow-Performing Scripts