Code quality

from Wikipedia, the free encyclopedia

With code quality is in programming the measure referred to which the source code of a program needs existing, the formal design in question met.

Code quality is a sub-aspect of software quality with which non-functional requirements such as conformity, comprehensibility, analyzability, modifiability, adaptability, testability (e.g. named and defined according to ISO / IEC 9126 ) are to be met or supported.

In linguistic usage, the terms programming style or coding style are also used for the same subject . B. Code structure, code format (ation) etc.

General

As part of the overall concept of quality for software , which includes “the entirety of the features and characteristic values ​​of a software product that relate to its suitability to meet specified or required requirements”, “code quality” refers to the non-functional and more formal ones Requirements to be met by the design of the source text.

A high code quality promotes the comprehensibility and maintainability of the source text. The use of complexity metrics alone and the improvement of the code parts shown lead to approximately 20% higher productivity in software maintenance. In general, improved comprehensibility and maintainability are achieved through formal cleanliness and an understandable structure.

Since software development is a creative process, an explicit subdivision into “good” or “bad” code is not easy. There are quasi-standardized method concepts according to which software is developed; for the creation of code, however, often only so-called best practices , design patterns (including identified anti-patterns ) or style guides related to the source code with an optional character can be found. Nevertheless, code quality can be described, among other things with suitable software metrics such as complexity metrics .

With tools for source text formatting , program code can be automatically adapted to certain format specifications.

criteria

“Good code” is primarily characterized by a clearly defined appearance that is visible from the outside. With source text that has not been thought through or is written under time pressure, attempts are often made to complete several tasks at once, the code thus loses the ability to clearly communicate the content of the order and is therefore often characterized by so-called code smells . In this way, the expressiveness, control and expandability are reduced or made more difficult.

On the basis of this determination, various differentiation criteria can be formulated, which are also of interest for test-driven development :

  • Readability - How easy can other developers understand the code?
  • Testability - To what extent is the code suitable and prepared for automated testing?
  • Changeability - How easy does the code make it for other programmers to extend it?

These are not objectively measurable criteria. Nevertheless, source texts can be assessed differently with the help of these three quality features.

Under certain conditions, the portability of code can also be a criterion for its quality. However, this only affects code whose interpretation and execution depends on the CPU family or the processor type of the computer on which the code is to be run. One also speaks of “machine-dependent code”, which is important for portability. In cross-platform software projects in which lower programming languages ​​are used, portability plays a role in many cases.

The code quality to be striven for is also dependent on the extent to which the quality criteria are relevant depending on the situation. The criteria z. B. if the software is only to be used once (as opposed to permanently); or in the private sector (possibly in an entrepreneurial environment with possibly many software developers ). The lower requirements in such cases can accordingly also be reflected in the program code.

Quality assurance measures

Examples of measures to produce “good program code” can include: a. be:

literature

  • Sebastian Kübeck: Software renovation - further development, testing and refactoring of existing software . mitp-Verlag, Heidelberg 2009, ISBN 978-3-8266-5072-7 .
  • Robert C. Martin: Clean Code - Refactoring, Patterns, Testing, and Clean Code Techniques . mitp-Verlag, Heidelberg 2009, ISBN 978-3-8266-5548-7 .
  • Frank Westphal: Test-driven development with JUnit and FIT . dpunkt.verlag, Heidelberg 2005, ISBN 3-89864-220-8 .

Individual evidence

  1. Helmut Balzert: Textbook of software technology. Part 2: software management, software quality assurance, business modeling. 1998, ISBN 3-8274-0065-1 , p. 257.
  2. ^ Capers Jones: Software Assessments, Benchmarks, and Best Practices . Addison-Wesley, 2000, ISBN 978-0-201-48542-4 (English).
  3. Donis Marschall, John Bruno: Solid Code. 2009, ISBN 978-3-86645-664-8 .
  4. ^ A b Robert C. Martin: Clean Code - Refactoring, Patterns, Testing, and Techniques for Clean Code. 2009, ISBN 978-3-8266-5548-7 , pp. 43-44.
  5. Jan Brennenstuhl: Clean software through TDD? - How test-driven development leads to better code quality. 2012.
  6. ^ Brian Hook: Portable Code: An Introduction to Platform Independent Software Development. Open Source Press, Munich 2006, ISBN 3-937514-19-8 .