Thoughts on cyclomatic #complexity in #golang's world
▻https://hackernoon.com/thoughts-on-cyclomatic-complexity-in-golangs-world-51db3507e1ec?source=r
Cyclomatic complexity can be helpful in keeping us away from writing complex code that can be more error prone, more complex to be tested and harder to reason about. I would give a special attention for the latter one as it implies in low readability and high maintenance costs. For example, an if/else statement is commonly used as:if THIS then do some logic in order to return THATif THAT then do some logic in order to return THISif SOMETHINGELSE then do some logic in order to return THAT and THISelse do some logic in order to return THIS and THATUsually each block contains some logic in order to do something. Naturally each piece of logic requires attention as one must understand what a block is doing, what is its purpose and if the expected result is what is being produced. Now (...)