top | item 45877640

Builder Design Pattern and Cyclomatic Complexity Reduction

2 points| johnjr | 3 months ago |johnjr.dev

1 comment

order

johnjr|3 months ago

In this post, I will explain in detail how I used the builder design pattern together with the bit mask field technique to reduce complexity. As a result, I decreased the cyclomatic complexity from 24 to 0 and reduced development time from hours to minutes.

The rest of this post is organized as follows sections:

- The problem explains the problem I was solving. - Creating the bit mask field presents a solution to the problem. - Cyclomatic Complexity discusses cyclomatic complexity and calculates this metric for the solution presented in the section above. - Builder design pattern explains the builder design pattern and describes the refactoring process that removed complexity. - Conclusion summarizes this post. - References provides references related to the topics discussed here. All the examples shown here are in C++.