Skip to main content
Dressed the naked link.
Source Link

From Cyclomatic complexity (Wikipedia):

The cyclomatic complexity of a section of source code is the count of the number of linearly independent paths through the source code.

Ref: http://en.wikipedia.org/wiki/Cyclomatic_complexity

  • I recommend that you keep that number under 10 in a single method. If it gets to 10, then it's time to re-factor.

  • There are tools that can evaluate your code and give you a cyclomatic complexity number.

  • You should strive to integrate these tools into your build pipeline.

  • Don't literally chase a method size, but try to look at its complexity and responsibilities. If it has more than one responsibility, then it's probably a good idea to re-factor. If its cyclomatic complexity increases, then it's probably time to re-factor.

  • I'm fairly certain there are other tools that give you similar feedback, but I didn't have a chance to look into this yet.

The cyclomatic complexity of a section of source code is the count of the number of linearly independent paths through the source code.

Ref: http://en.wikipedia.org/wiki/Cyclomatic_complexity

  • I recommend that you keep that number under 10 in a single method. If it gets to 10, then it's time to re-factor.

  • There are tools that can evaluate your code and give you a cyclomatic complexity number.

  • You should strive to integrate these tools into your build pipeline.

  • Don't literally chase a method size, but try to look at its complexity and responsibilities. If it has more than one responsibility, then it's probably a good idea to re-factor. If its cyclomatic complexity increases, then it's probably time to re-factor.

  • I'm fairly certain there are other tools that give you similar feedback, but I didn't have a chance to look into this yet.

From Cyclomatic complexity (Wikipedia):

The cyclomatic complexity of a section of source code is the count of the number of linearly independent paths through the source code.

  • I recommend that you keep that number under 10 in a single method. If it gets to 10, then it's time to re-factor.

  • There are tools that can evaluate your code and give you a cyclomatic complexity number.

  • You should strive to integrate these tools into your build pipeline.

  • Don't literally chase a method size, but try to look at its complexity and responsibilities. If it has more than one responsibility, then it's probably a good idea to re-factor. If its cyclomatic complexity increases, then it's probably time to re-factor.

  • I'm fairly certain there are other tools that give you similar feedback, but I didn't have a chance to look into this yet.

Source Link
CodeART
  • 4.1k
  • 1
  • 22
  • 23

The cyclomatic complexity of a section of source code is the count of the number of linearly independent paths through the source code.

Ref: http://en.wikipedia.org/wiki/Cyclomatic_complexity

  • I recommend that you keep that number under 10 in a single method. If it gets to 10, then it's time to re-factor.

  • There are tools that can evaluate your code and give you a cyclomatic complexity number.

  • You should strive to integrate these tools into your build pipeline.

  • Don't literally chase a method size, but try to look at its complexity and responsibilities. If it has more than one responsibility, then it's probably a good idea to re-factor. If its cyclomatic complexity increases, then it's probably time to re-factor.

  • I'm fairly certain there are other tools that give you similar feedback, but I didn't have a chance to look into this yet.

Post Made Community Wiki by CodeART