Code quality

With the code quality measurement is known in programming, with the source code of a program compliant with existing, the formal design requirements in question.

Code quality is an aspect of software quality, especially with the non-functional requirements such as conformity, of course, analyzability, modifiability, adaptability, accountability ( so named, for example, and defined by ISO / IEC 9126 ) met or support should be.

In colloquial usage, the terms style of programming or coding style used for the same facts, more synonyms are, for example, code structure, code format ( ation ), etc.

Generally

As part of the overall concept of quality for software that " the totality of features and feature values ​​of a software product [ includes ], which relate to its suitability, fixed or to meet expected requirements " to " code quality " refers to the non-functional and more formal requirements that must be met by the design of the source code.

A high code quality promotes the understanding and maintainability of the source code. Alone, the use of complexity metrics and improving so indicated pieces of code lead to about 20 % higher productivity in software maintenance. In general, the improved understandability and maintainability is achieved through formal cleanliness and understandable structure.

As this is a creative process in software development, an explicit division into "good" or "bad" code is not easy. Although there are quasi- standardized methods concepts on which software is developed; often used for creating code, however, can be only so-called best practices, find design patterns (including identified anti-patterns ) or related to the source code style guide with optional type. Nevertheless, code quality can be described, among other things, with suitable software metrics such as complexity metrics.

With tools for source code formatting program code can be automatically adapted for a specific format requirements.

Criteria

" Good code " is characterized primarily by a clearly defined and visible from the outside appearance of. With undurchdachtem or niedergeschriebenem under time pressure source is often trying to fulfill several tasks at once, the code thus loses the ability to job content to communicate clearly and distinguished as a result often by so-called code - smells from. In this way, the expressive power, control, and extensibility is reduced or made ​​more difficult.

On the basis of that finding, several distinguishing criteria can be formulated, which are also available for test -driven development of interest:

  • Readability. - How well can the code by other developers understand?
  • Testability. - To what extent is the code for automated testing is suitable and prepared?
  • Changeability. - How easy the code is doing it to other programmers to expand it?

This is not about objectively measurable criteria. However, source code with the help of these three qualities can be distinctively assessed.

Under certain conditions, the portability of code can be a criterion for its quality. However, this only applies to such a code, its interpretation and execution of the CPU family and the processor type of the computer on which the code is to be made ​​to run, depends. This is also called " maschinenabhängigem code" which has a meaning for portability. In cross-platform software projects into which worked with lower programming languages, portability plays a role in many cases.

Similarly, the aspired code quality is dependent on the extent to which quality criteria are of importance depending on the situation. Less important are the criteria, for example, to when the software only once (as opposed to permanent) should be used; or in the private sector (in contrast to an entrepreneurial environment with possibly many software developers ). The lower requirements in such cases may also reflect in the program code accordingly.

Quality assurance measures

Examples of measures to establish "good program code " may be, inter alia:

  • Creation and adoption of programming guidelines
  • Training in teaching the provisions contained therein
  • Coaching / support still inexperienced programmers in programming ( coding )
  • Use of code generators ( some of which offer a graphical flow representation ) and / or other programming standards
  • Use of methods for improving the structure of source code, such as refactoring
  • Code reviews for the regular examination of the code quality
  • Run of software metrics as part of a measure of quality assurance
195939
de