Select Page

Programming guidelines – curse or blessing?

Lectures, articles, and books constantly emphasize that code quality is a crucial factor in a project's success. Therefore, there are ongoing attempts to introduce regulations that improve code quality. However, the code delivered by many developers is anything but elegant. One approach to ensuring code quality is the use of programming guidelines.

On the sense and nonsense of coding guidelines

Many companies have their own guidelines for how the code in their embedded projects should look. But when it comes down to it, each developer usually decides for themselves how to write the code. Attempts by individual colleagues to improve something or to work uniformly are rarely successful. This is because it might require changing one's way of working – and that costs time and could jeopardize the timely completion of the project.

Then there are also companies that have guidelines, but too many of them. This often creates uncertainty, because with too many (potentially contradictory) rules, nobody knows which ones they're supposed to follow. So, in the end, everyone just does their own thing.

What are the reasons behind programming guidelines?

Often, there are strict rules that go far too far and severely restrict the developer's creativity. Supposedly insecure constructs are forbidden in order to increase code security. Additionally, these strict rules prevent the use of modern programming techniques – sometimes the code doesn't meet current requirements, which in turn reduces security.

To better understand the policy dilemma, one must consider the reasons for introducing programming policies:

Option 1:
The rules are designed to help create a codebase that every developer can easily navigate. The code is well-structured and easy to read. Collaboration between team members should be seamless.

Programming guidelines

Programming guidelines

Option 2:
A strict set of rules is created that prohibits all constructs deemed critical, based on the assumption that every employee on the project is also a good programmer. If know-how is replaced by rules, development can be outsourced more effectively and cost-efficiently to low-wage countries.

Programming guidelines

Programming guidelines

Investing in knowledge transfer and fundamentals

Option 2 is unlikely to work – know-how cannot be replaced by rules. Problems in software development are not the result of too few rules, but of too little knowledge. The main problem is that the complexity of software is underestimated in traditional industries.

Management often operates on the principle that what weighs nothing is worth nothing. Consequently, far too little is invested in the fundamentals. Engineers are presented with a development environment without having properly learned the basics. Therefore, thorough knowledge transfer must precede every rule. This sounds expensive, but in the long run, it's the most cost-effective solution.

Programming guidelines cannot replace a solid education. They are a supplement to improve teamwork.

Another important point is the developers' motivation. If the purpose behind the rules isn't clearly communicated, there will always be violations. Ultimately, the developer should be the primary beneficiary of the rules. Otherwise, the rules have missed their mark and won't be accepted.

Furthermore, the number of rules should be manageable (e.g., the front and back of an A4 sheet). In very few cases does a programmer work through an extensive rule set. Rules concerning code formatting must be automatically checked. Check-in should not be possible if a rule is violated.

Conclusion 1:
Programming rules cannot save the project.

Conclusion 2:
Without sufficient training and know-how on the part of the developers, even the best rules will not be able to save anything.

Conclusion 3:
Limit yourself to a few, but sensible rules.

Take advantage of the know-how from our training, and learn how to improve code quality efficiently and sustainably.

Further information

MicroConsult Training & Coaching: Embedded Programming

MicroConsult Training & Coaching: Embedded & Real-Time Software Development

MicroConsult Expertise: Embedded Software Development

MicroConsult Expertise: Software Quality


Pictures:
In the text: Frank Listing; Featured image: Adobe Stock

MicroConsult Newsletter

With the MicroConsult newsletter, you'll stay on the pulse of the embedded world. Look forward to proven practical knowledge, real professional tips, and current events – directly from our experts for your project success.

Subscribe now!

Published by

Thomas Batt

Thomas Batt