What points and rules should be considered and followed when writing program code? What methods and approaches can be used to improve code quality despite, or perhaps because of, growing team sizes and increasing project complexity?
A good approach is to establish programming guidelines that specify requirements for the code and its commenting. Adhering to these guidelines results in consistent, cohesive code. Figuratively speaking, a "unified language" is agreed upon, and the code is written according to its conventions. Code passes through many hands during development, so the guidelines should be strict and comprehensive to prevent wasted time due to poorly written code. Furthermore, the guidelines and their adherence establish a certain quality standard within the company, ensuring that no uncommented code or code riddled with jump statements (goto) makes it to review or, worse, into the final product. These programming guidelines cover all aspects of the software, from file names and documentation styles to variable naming conventions.
When considering what information the instructions should contain, I consider the following guidelines to be useful. For a structured approach, an initial division into Source code and Comments In the source code, the specifications functionallearner or formulalearner Be nature.
|
|
| Dipl.-Ing. Goran Madzar, Partner, Senior Systems Engineer E-mail: madzar@medtech-ingenieur.de Phone: +49 9131 691 240 |
|
Do you need support with the development of your medical device? We're happy to help! MEDtech Ingenieur GmbH offers hardware development, software development, systems engineering, mechanical development, and consulting services from a single source. Contact us. |
|
At Comments The language, minimal content, and positioning are specified. An example of this is: Every function must be commented. This comment must contain a brief function description and describe all passed parameters. The use of a tool can also be specified during commenting. Doxygen is a very good and free tool that generates printable documentation of the program code from the keywords used in comments.
Functional specifications for the source code include requirements for functions, data types, and operators. Certain functions that make the code difficult to read should be prohibited (goto(), complicated constructs with decrements and increments). Furthermore, it is worthwhile to restrict the data types to be used. For example, the use of data types from stdint.h the size and value range independent of the target system.
Both formal specifications for the source code This concerns the external appearance. This defines requirements such as indentation with spaces instead of tabs, bracketing of functions, and the naming of constants, variables, functions, and other attributes. Using the module/class name as the function prefix makes it much easier to assign functions to modules.
Well-commented and "clean" code is easier to reuse, pass on to another programmer, and maintain. A function whose task is precisely defined and whose required parameters are described is easy to understand and therefore easy to use.
And in general, I can say: As a programmer, it makes me proud when I have written a nice piece of code and receive a compliment for it during a review or from the customer ;)
One challenging aspect, of course, is the length of the guidelines. The guidelines I created are 30 pages long. It's also a good idea to create a summary that doesn't exceed one page (DIN A4). This summary can serve as a compact reminder at work. The summary is shown in the image below and can be downloaded as a PDF. Anyone interested in the complete guideline can simply contact me.

Programming guidelines overview as PDF for download
What are your thoughts on the topic of programming guidelines? Are they necessary? What experience do you have with this topic? Where do you see the problems or weaknesses in their creation and implementation in companies? I would be very happy to hear from you, of course, even if you have any criticism, suggestions, or questions on the topic. Anyone interested in the complete guideline can simply contact me.
Best regards
Benjamin Eichinger
