THE STANDARD FOR ALL CODE

What is clean code?

Clean Code is code that's easy to read, maintain, understand for developers and other teams while improving the quality of their software through structure and consistency with performance demands. It lets you get the most value and purpose out of your software.

Demo anfordern

The standard for all code.

Clean Code

98%

of organizations agree that Sonar helps you build Clean Code quickly and systematically

80%

of organizations chose Sonar to establish best coding practices in their development teams

80%

of organizations chose Sonar to standardize the quality and security of their codebase

“Sonar enables our organization to achieve our Clean Code goals in a predictive and systematic manner.”

Adam Richeimer, VP, Technology @ Y Meadows

Try a better way to code

Beginnen mit Open SourceAlle Editionen erkunden

Clean code principles and best practices

In order to deliver software that is of high quality, reliable, maintainable, and secure, it is imperative that the underlying code is robust. By following best coding practices, organizations can achieve the agility, velocity, and scale of development needed for their business goals. 

  • Consistent

  • Intentional

  • Adaptable

  • Responsible

Consistent code

The code is written in a uniform and conventional way. All the code looks similar and follows a regular pattern, even with multiple contributors at different times. Consistent code is formatted, conventional, and identifiable. For example, when code is formatted well, it is systematic and regular, which reduces differences between authors’ coding styles and makes code much easier to review by peers on pull requests.

  • Formatted: The code presentation is well-organized, systematic, and regular. Non-semantic choices, such as spacing, indentation, and character placement, remain consistent throughout the codebase, maintaining uniformity across files and authors.
  • Conventional: The code performs tasks with expected instructions. Faced with equally good options, the code adheres to a single choice across all instances, preferring language conventions. This includes using the appropriate programming interfaces and language features.
  • Identifiable: The names follow a regular structure based on language conventions without arbitrary differences. The casing, word separators, suffixes and prefixes used in the identifiers have purpose, without arbitrary differences.