loading...

Discussion on: Coding Concepts! Cyclomatic Complexity

Collapse
adekoder profile image
adekoder

"Your suggested reduction in cyclomatic complexity (which I agree with) actually increases your essential complexity... though not above the structured/unstructured threshold. You add an additional exit point to the function, which is a trade off. Your second example:
"

Additional exit point will not be added since the msg variable will have a default, then you only change the content of the variable when the if statement evaluate to true, and only one return statement is needed.

Collapse
jdsteinhauser profile image
Jason Steinhauser

You're absolutely right. I was mixing code samples in my head. Thanks for the correction!

Collapse
designpuddle profile image
Chris Bertrand Author

Very true! Thanks for the comment.