I think this question is more about style: I have an algorithm that has a very high CC (and a lot of lines!). I want to reduce it, and it's easy since there are pieces of code that can be grouped. The problem is that doing things this way I would have a "big" function calling "small" functions which are only called once.
In my opinion breaking a big function in small pieces is better for the legibility of the code (in this case) despite functions are called once.
What do you thik? How do yo do in similar cases?
Breaking a big function into smaller, mostly separate chunks is a perfectly good idea. It makes the code more readable and the control flow more clear.
If the functions are static and called only once, the compiler will probably inline them for you without even being asked, so there's no need to worry about runtime cost.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With