As part of developing a new Programmer 1 Online course, AMX has released a new Netlinx Programming Syle Guide. Here’s what it’s all about…
The personal nature of coding style can make it difficult to collaborate in a team atmosphere and support a hardware manufacturer that relies on custom programming. By providing a style guide for the NetLinx language it is our goal to drive standardization and consistency among the programming community. The intent of this document is not to convey how to program a NetLinx control system but rather establish a standardized convention of the way code is formatted within any given program.
In its most basic terms, coding style is how your code looks, plain and simple. Coding style can be extremely personal and everyone has their preferred style whether it’s because that’s how they were originally taught, they picked it up from another programming language, or it’s just something that they developed on their own. It is not uncommon to have to context switch between different programming languages and it is always preferred to use the defined style of the language you are working with if a style guide is available. While the hardware your code is running on doesn’t care how the code looks, other programmers and support staff certainly do. The way code looks adds to our understanding of it.
Don’t confuse the rules of the style with the rules of the language. The rules of the language will allow you to write code in a large variety of styles, which is part of the problem. A lot of programmers, when faced with issues in code someone else wrote, will reformat it in their own style in order to better understand what’s going on and resolve the issue. When everyone is writing code that looks different, everyone else is constantly trying to visually parse the code before being able to understand it. When everyone is writing code that looks the same, your brain can relax a bit as the understanding comes faster and some potential issues can be avoided entirely just by using a consistent programming style.
The concept of coding “best practice” is not covered as it pertains to CPU and memory efficiency. Using this style guide will certainly help you develop more consistent, readable code but it is not designed to entirely avoid programmatic issues like unnecessarily complicated string parsing operations or writing code that is not easily adaptable to system changes. Coding best practice can be learned best in a Harman Professional University classroom, interacting with Technical Support, or AMX technical documentation.