“Clean code” and architecture for
Industry 4.0

Headerfoto von Leuze Electronic Success Story mit Axivion

Success Story in collaboration with Leuze electronic

This Pic shows the logo of Leuze electronic

“Clean code” and architecture for Industry 4.0

Intelligent camera systems play a key role in the digitalisation of industry. Specially designed optics and lighting together with cutting-edge sensor technology give the systems their power. However, the special ‘intelligence’ for Industry 4.0 of these modular camera systems is down to their software, which is continuously refined for different variants and enhanced with new features. To ensure a clean architecture and code basis for the software platform of their new camera-based code reader DCR 200i, Leuze electronic has opted for the Axivion Suite.

Download Leuze Success Story as PDF

The DCR 200i by Leuze is a reader for identifying bar, stacked and 2D codes. It provides excellent reading results even at conveyor belt speeds of up to six metres per second. Thanks to its modular design the DCR 200i adapts flexibly to a wide  variety of different demands. With the aid of the configuration wizard in integrated webConfig tools it can easily be commissioned, operated and maintained. The camera can even be configured using a smart phone app.


The outstanding performance of the DCR 200i is down to its powerful hardware coupled with state-of-the-art software. The DCR 200i is based on a software platform developed in-house which also forms the foundation for other Leuze product ranges. This framework comprises a complex components system with numerous variants. For the developers at Leuze the challenge now is to check and maintain the software platform codebase, which is being continuously extended during ongoing operational use. The aim is to guarantee the maintainability of the software over long product lifetimes which often exceed ten years.

Because the framework forms the basis for several product lines with varying functional scopes, the code checking process focuses particularly on locating and evaluating dead, unused and duplicate code. In addition to this it was required to check the code for compliance with both generally accepted programming guidelines such as MISRA and also self-defined specifications.

Software metrics, for instance regarding complexity and nesting depth, have to be checked for compliance with thresholds. Both new developments and the extensive codebase at Leuze in C and C++ have to be analysed.


After in-depth evaluation of various tools, Leuze Competence Center Software chose the Axivion Suite. Alongside the tool suite’s impressive analysis functionality, the decisive factor was its adaptability: The out-of-the-box version of Axivion Suite was heavily customised for Leuze. In doing so the Axivion professional services team enhanced the standard code and  architecture checking tools provided with the tool suite by adding company-specific style checks and integrating them into the automated analysis process.

Particularly in critical end application areas, such as data exchange between the framework’s components, the architecture check plays a key role. To ensure the proven backing up of this data it is vital for the communication to fully meet the architecture’s specifications, and it is here that, in addition to the custom rules, the Axivion Suite’s architecture analysis comes into play. This detects possible deviations from the pre-defined model xand supports software developers and architects in the quality assurance of the codebase for the multi-product software platform.


Right from the start the use of the Axivion Suite by the development team was a great success thanks to the rapid results in the daily build. The warnings of potential errors at the early development stage saved the team a great deal of work. If these potential trouble spots in the source code had not been detected until the system test this could have entailed a major additional workload, which can now be avoided from the outset.

A further factor facilitating the daily development process is the automated checking of company-specific metrics and programming guidelines.

This enables Leuze to check not only the fulfilment of normal industry expectations regarding high software quality but also its own even more stringent standards.

Despite these highly individual adaptations, the tool suite and its automated regular reports were integrated seamlessly and rapidly into the development process. In its analyses the Axivion Suite includes not only newly-written code lines but also the software’s codebase via targeted delta analysis. The tool suite detects duplicates reliably using its clone recognition algorithms,  it locates potentially problematic code  areas, identifies style violations and tracks down cyclical dependencies.

Thanks to this continuous checking of the source code during the daily build Leuze is able to actively counteract creeping software erosion, i. e., the steady loss of software quality.

As part of the Leuze “Clean Code” initiative developers devote themselves to the software platform’s codebase during in-house “Axivion days”. The aim of these sessions is to improve both newly developed code and the old codebase step by step with the aid of Axivion Suite.

This enables Leuze to maintain the high quality of the software used in both its tried-and-tested and newly developed intelligent cameras and sensors for use in Industry 4.0.


Leuze electronic is one of the world’s leading innovators in optoelectronic sensor technology and is internationally renowned as a leading manufacturer and system provider in the field of electrical automation. Its core focuses are on intralogistics  and the packaging industry, machine tool construction, the automotive industry and medical technology. The portfolio includes switching and measuring sensors, identification systems, image processing and data transmission systems and also safety at work components and systems. Founded in 1963, the company, which has its headquarters in Owen/Teck, Germany,  possesses both specific application  know-how and wide-ranging knowledge of the sector.

Over 1,000 employees at 22 locations are active in the fields of development, production, sales and service, supported by more than 40 worldwide sales partners. Innovative product development, custom-built global solutions and a comprehensive range of services all spell Smart Sensor Business 4.0 at Leuze electronic.


Sources of images: Leuze electronic GmbH & Co. KG