title: Cyclomatic complexity calculation - concrete example
body: <p>Let's suppose we have the following code:</p>
  
  <pre><code>public void testIt(boolean a, boolean b){
     if (a){
     ...
     }
     if (b){
     ....
     }
  }
  </code></pre>
  
  <p>As I know there are three methods to calculate. I will use two of them: region formula and the rule of thumb.</p>
  
  <p>Using region formula we have two regions <code>if(a){this is the first one}</code> and <code>if (b) {this is the second one}</code>. So CC = two regions +1 = 3.</p>
  
  <p>The rule of thumb is from <code>Testing for ISTQB Advanced Level Technical Test Analyst vol 3</code> book:</p>
  
  <blockquote>
    <p>Now, this is all simple enough for a small, modest method like this.
    For larger functions, drawing the graph and doing the calculation from
    it can be really painful. So, a simple rule of thumb is this: Count
    the branching and looping constructs and add 1. The if statements,
    for, while, and do/while constructs, each count as one. For the
    switch/case constructs, each case block counts as one. In if and
    ladder if constructs, the final else does not count. For switch/case
    constructs, the default block does not count. This is a rule of thumb,
    but it usually seems to work.</p>
  </blockquote>
  
  <p>So according to this rule CC = two if conditions +1 =3.</p>
  
  <p>However, on stackoverflow in chat with one user I was said that the CC of this code = 4 (he used the third method) and the following image by that user was provided:
  <a href="https://i.stack.imgur.com/aYiLW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/aYiLW.png" alt="enter image description here"></a></p>
  
  <p>So what is the cyclomatic complexity of this code? 3 or 4 or?</p>