Programming guidelines

Benjamin Eichinger

20/12/2015

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.

Your contact person:

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.

make contact


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.

Programmierrichtlinie C/C++ (Übersicht)
C/C++ Programming Guidelines (Overview)

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

 


Written by Benjamin Eichinger

Benjamin holds a bachelor's degree in medical engineering and a master's degree in electrical engineering. At MEDtech Ingenieur, he primarily works in software development. In addition to hardware-oriented programming in C and C++, he also creates graphical interfaces using the Qt class library.


More articles

  • 05/11/2026
  • General, AI, Regulatory, Requirements Engineering, Software, Systems Engineering, Tools

Can AI radically increase efficiency in medical technology? Formulating requirements, structuring information, clarifying ambiguities: A great deal of work is involved in the development of medical devices before the first technical solution is implemented. ...

Read more
  • 08/10/2026
  • General, Documentation, Medioora, Requirements Engineering, Software, Systems Engineering

When requirements start to spread... The larger and more complex a medical device development project becomes, the more information is generated. Requirements are documented, technical decisions are made by others. ...

Read more
  • 28/05/2026
  • General, Documentation, Embedded, Hardware, Standards, Software

Why FPGAs in medical devices are increasingly becoming the focus of software audits and how you can avoid regulatory risks early on. When programmable logic suddenly ends up in a software audit, things can quickly get uncomfortable. ...

Read more