Cure for Hiccups

06 Feb 2019

An Ounce of Prevention

Coding standards are the definitive cure for hiccups. No matter what anyone else tells you, gargling water is not going to work. In fact, don’t do that anywhere near your computer. It’s dangerous. Ahem, to reiterate, coding standards cure hiccups in software development. They work mainly by catching bugs and improving readability. For these reasons, coding standards are essential in large, multi-person projects, where the threat of a hiccup epidemic is most severe.

Bug Catcher

As previously mentioned, coding standards can guard against hiccups and reduce development times by catching bugs early on. One example of this would be the standard of consistent-return, which dictates that a return statement must “either always or never specify values”. In most cases, wherein one path specifies a return value and another doesn’t, this violation is due to an error on the developer’s part. This simple mistake could easily turn into a major headache, but with coding standards it would be caught immediately. This saves developers having to rummage through lines and lines of code to find something potentially as small as a misspelling. Another way that coding standards make writing code more efficient, is by reducing the mental drag of having to maintain a consistent formatting style. Before I became acquainted with coding standards, I would often find myself debating the merits of spaces before braces, single quotes, double quotes, and the use of trailing commas in arrays and objects. With coding standards, there is no room for debate. Coding standards are useful in this respect because they allow the developer to focus on solving higher level problems, rather than be bogged down by minutia.

Readability

However, by far the most significant benefit of using a coding standards is that it improves the readability of code. This has a significant impact on the ability of developers to work together to take on large projects over extended periods of time. In general, coding standards allow developers to pick up where others left off, all the while maintaining a consistent style and abiding by accepted best practices. Without adherence to a singular coding standard, developers will naturally default to their own. This puts an unnecessary burden on the reader, who must grow accustomed to each standard as they come across it in the code. In more specific cases, coding standards increase readability by reducing the number of redundancies found in code and enforcing the use of appropriate keywords. A few ways that it reduces redundancies is by flagging empty constructors, duplicate functions, and unnecessary concatenation. Coding standards also enforce appropriate keywords by, for example, flagging variables that are declared with the let keyword when they are being used as a constant. This can help to clarify the use of variables, which makes it significantly easier to modify code without unintentionally breaking it.

Conclusion

Overall, coding standards are incredibly useful. Whether working alone or in a team, coding standards help developers by making it easier to write, read, and debug code. From my own personal experience, I can honestly say that coding standards make programming an altogether more enjoyable experience, and really, they do help with hiccups.