5 Rules of 'Good Code' | TTC New Zealand

5 Rules of 'Good Code'

In this article, we'll offer five rules or standards that can be applied to the code testing situation and how TTC can play a critical role in ensuring all code practice is up to standard.

TTC Americas Chris Rolls

In a similar way to how atoms are the building blocks of the universe, programming code is the foundation of quality software applications.

While it is a complex process that takes skills and experience, it isn't impossible to master - but these individuals are often hard to find. Depending on the scope of your software development, some organisations have coding standards that their developers and testers are supposed to adhere to.

However, the problem with this theory is that everyone has been trained differently and has disparate ideas of what is right and wrong in the world of code.

1) Descriptive function and method names

There are a number of rules that should be followed when it comes to descriptive function and method names. According to SoftwareQATest.com, this including using both upper and lower case letters and avoiding abbreviations.

In addition to this, software developers and testers are recommended to be as descriptive as possible to ensure as much detail has been added to the programming code.

2) Consistent coding style

When software testers locate problems with the application, the problem is often caused by issues with the programming code - namely, consistency. If the coding style is not similar across the software, it can prevent the application working up to standard as well as becoming a real headache to solve later.

In avoid this, naming conventions, indentations and the use of brackets should be consistent. Businesses need to highlight this fact across all their coders to ensure that a software project isn't delayed due to problems with consistency.

3) Ensure readability

While programming code isn't something that everyday people can read, a professional coder will be able to spot errors and issues a mile off if it isn't readable. This skill is something that develops over time, but as soon as coders can produce readable code, the end product will be much better.

TTC can help. We offer a number of industry-standard training courses that are dedicated to improving the skills of software developers and testers. By learning global standards, coders will be able to produce higher quality programming and the project can progress as planned.

4) Avoid obvious comments

According to code experts Tuts+ explained in a 2011 article that avoiding obvious comments in programming code is also a handy tip to understand. While it can be helpful in some situations, they believe that it can be overdone or simply irreverent to the final product. If something is that obvious in the text, it isn't from a productivity point of view to add it again.

Tuts+ offers the solution in which coders can combine it to a single line instead. While this issue is not going to delay a project, it comes under the umbrella of best practice and something all software developers and testers must understand.

5) Limit line length

This point is similar to the one above. From a readability and productive point of view, it is also important to avoid writing long horizontal lines of code. Tuts+ recommends that every line of code should be around 80 characters long, while SoftwareQATest.com puts the figure at around 70 characters maximum.

One of the reasons behind this is that if software testers view the code from some applications, they would be able to see the full line of code.