frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Builder Design Pattern and Cyclomatic Complexity Reduction

https://johnjr.dev/posts/builder-design-pattern-and-cyclomatic-complexity-reduction/
2•johnjr•2h ago

Comments

johnjr•2h 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++.