
When following principle number one, if your code ends up so deeply nested that it starts beyond your screen width, you should review your method. Treat your program like a tree: cut off the deadwood to support new growth and avoid risk. If your code is dead, delete it!!! Go through all those commented blocks, unused variables and unreachable code. Code sniffers and IDEs are great at detecting code standard violations and help to maintain a clean, consistent codebase. The main thing is to adopt a standard (for example, PSR12), then stick to it. Who cares about tabs versus spaces, or Allman versus K&R. So many standards, so many possibilities. Look at it this way: if your code is immediately understandable, down the line, it could save the week-end of a post-production support colleague – or even your own.

Jason made a list of 10 coding practices to keep in mind so that you, or a future programmer, can swiftly and intuitively follow your code. While none of it was revolutionary, I found it was a good reminder of code-writing ground rules. I had the opportunity to attend a presentation by Jason McCreary gonedark) on best practices for writing code.

That someone could even be you! And you might be puzzled by what you wrote just a few months earlier, either because it’s no longer fresh in your mind, or because you didn’t make it easy to read.

Sooner or later, someone will read your code and try to understand its purpose.
