9.9.21
Clean Code

Clean Code Development: The Virtues

In order to achieve the core values of clean code development, there are a number of virtues that must be considered during the development process. These should be reminded regularly in order to be internalized until they automatically draw attention to themselves in the event of violations. 

An overview of the Clean Code Development virtues

Value Variation

This virtue stands in the way of frequent efforts to consolidate, unify, and standardize. The variations are necessarily results of continuous improvement and should be estimated because they increase flexibility and resilience. This virtue contributes to the values of changeability and continuous improvement.

Do Only What's Necessary

Clean code developers should refrain from premature optimizations so as not to optimize unnecessary pieces of code that may no longer be relevant later on. Optimizations always cost a lot of effort. If you are careful, you often save valuable resources for what is really useful for the customer. Clean Code Developers don't write code snippets that aren't really needed. If you do more than the simplest thing, you keep the customer waiting and make the solution unnecessarily complicated. It is therefore important to always find the simplest solutions. This virtue contributes to the values of production efficiency and changeability.

Exemplary principles for this are:

  • Beware of optimizations! (red grade principle)
  • You Ain't Gonna Need It (YAGNI) (principle of blue rade
  • Keep it simple, stupid (KISS) (principle of the red grade)

Isolate Aspects

When Clean Code Developers isolate aspects during their daily work, they avoid unfavorable program structures that would make it difficult to understand and develop later. The virtue of “isolated aspects” contributes to the value of evolvability.

Exemplary principles for this are:

  • Don't Repeat Yourself (DRY) (Red grade)
  • Separation of Concerns (SoC) (orange grade)
  • Single Level of Abstraction (SLA) (orange level)
  • Single Responsibility Principle (SRP) (orange grade)
  • Interface Segregation Principle (ISP) (yellow grade)
  • Implementation reflects design (blue grade)
  • Integration Operation Segregation Principle (IOSP) (Red Grade)

Minimize Dependencies

Unnecessary dependencies between individual components of a system can make it difficult to understand and develop. For this reason, Clean Code Developers utilize the virtue of “minimize dependencies,” which makes a component less dependent on its environment. Interfaces between components must be made as simple as possible. Like its predecessors, this virtue contributes to the value of evolvability.

Exemplary principles for this are:

  • Dependency Inversion Principle (yellow grade)
  • Information Hiding Principle (yellow grade)
  • Law of Demeter (Green grade)
  • Open Closed Principle (green grade)
  • Tell, don't ask (Green grade)
  • Interface Segregation Principle (ISP) (yellow grade)
  • Integration Operation Segregation Principle (IOSP) (Red Grade)

Deliver on promises or Minimize Surprises (Honor Pledges)

Code should contain as few surprises as possible, including making the implementation reflect the design. A component offers functionality via its external interface. According to Liskov's substitution principle, components derived from it must also not contradict. This virtue also contributes to the value of evolvability.

Exemplary principles for this are:

  • Liskov Substitution Principle (yellow grade)
  • Principle of Least Astonishment (Yellow grade)
  • Implementation reflects design (blue grade)
  • Favour Composition over Inheritance (FCoI) (Red grade)

Embrace Uncertainty

Planning software development down to the last details in advance is virtually impossible. Instead of being afraid of constant change, we welcome it and adapt ourselves to it. We store all development levels in a version control system so that we can return to older versions or branch off new development lines at any time. Many automated tests give us the necessary security. This virtue contributes to the values of evolvability and continuous improvement.

Exemplary principles for this are:

  • Use a version control system (red grade)
  • Automated integration tests (orange grade)
  • Automated unit tests (yellow grade)
  • Mockups (test dummies) (yellow grade)
  • Continuous integration (green grade)
  • Inversion of Control Container (green grade)

 

Focus

Through component orientation, the test-first approach and the limitation of tasks completed in parallel, Clean Code Developers focus on the main problem and therefore work more efficiently. This virtue contributes to the value of production efficiency.

Exemplary principles for this are:

  • Component orientation (blue grade)
  • Test first (blue grade)
  • WIP limit

Value Quality

The requirements for high quality can only be ensured through automated testing, mutual reviews and static code analysis. Like the previous virtue, this virtue contributes to the value of production efficiency.

Exemplary principles for this are:

  • Accept only high quality
  • Automated unit tests (yellow grade)
  • Reviews (orange grade)

 

Get Things Done

Software cannot be used if it is not completed. Development is therefore carried out in small steps so that results can be delivered regularly. This virtue also contributes to the value of production efficiency.

Exemplary principles for this are:

  • Iterative development (blue grade)
  • Continuous Delivery (blue grade)
  • WIP limit

 

Keep things tidy (Stay Clean)

According to the Boy Scout rule from the red, the place should always be left cleaner than it was found. Minor improvements are made directly on the spot and are not postponed. Applied to software development, this means that code is rebuilt when it gets better as a result before the Clean Code Developer moves on to the next code location. This virtue contributes to the values of evolvability, correctness and production efficiency.

Exemplary principles for this are:

  • Observe the Boy Scout Rule (Red grade)
  • Apply simple refactoring patterns (red grade)
  • Complex refactorings (yellow grade)
  • Static code analysis (metrics) (green grade)
  • Code Coverage Analysis (Yellow Level)
  • Source code conventions (orange level)

 

Keep Moving

Clean Code Developers are constantly evolving over time and over many exercises. The eternal cycle of learning and improvement has no end point. The incentive is created by rewritten code by itself. This virtue is based on the values of continuous improvement.

Exemplary principles for this are:

  • Read, read (orange level)
  • Participation in professional events (yellow grade)
  • Share experience (green grade)
  • Reflect daily (red grade)
  • Root Cause Analysis (Red grade)
  • Measuring errors (green grade)
  • Issue Tracking (orange grade)
  • Regular retrospectives
No items found.

Weitere Artikel

Clean Code
7.9.21

Clean Code Development: The values

The value system of Clean Code Development comprises the values of evolvability, correctness, production efficiency and continuous improvement.

Clean Code
9.9.21

Clean Code Development: The Grades

Clean code development is divided into different grades, which you as a developer climb one by one and repeat in an eternal cycle

How can we advise you?
telephone
Online consultation
Contact request
telephone
We are looking forward to your call
+49 (0) 721-619096-0
+49 (0) 721-619096-19
Available for you from
Monday to Friday 8:00 a.m. to 4:00 p.m.
Online consultation
Book an appointment that's right for you online
We are looking forward to your message
If you would like to know which data we process and how long we store it, you can find further information in our Privacy statement.
Thank you so much! We have received your contact request!
Oh no! Something went wrong. Please try again!
contact