Question: 1 b ) Cyclomatic Complexity ( 1 2 points ) Note: A detailed discussion of the Cyclomatic Complexity metric can be found in Moodle. Task:

1b) Cyclomatic Complexity (12 points)
Note: A detailed discussion of the Cyclomatic Complexity metric can be found in Moodle. Task:
1. Specify the implemented function of the statistics method from Listing 1 precisely, but briefly and as generally understandably as possible. Distinguish between normal behavior (successful case) and exceptional behavior.
2.(YOU HAVE TO CONTINUE THE GRAPH SO YOU HAVE TO DRAW IT) Complete the control flow graph (CFG) on the next page for the statistics method according to Listing 1 or create a new CFG. The initial node is the one with the method signature as content. Note that the Cyclomatic Complexity calculation requires a CFG with exactly one output node (without an outgoing edge). You can easily transform a multi-exit CFG into one by adding an explicit Exit node and connecting all previous exit nodes to the new Exit node with an edge.
Hints:
Consecutive statements (except the initial node) between which no branching control flow takes place must be combined in a node (basic blocks).
Edges at branching nodes must be marked with the corresponding condition.
For the CFG, note the Scala semantics regarding exceptions. To make drawing the CFG easier, only consider exceptions that can actually occur at the respective points in the program (i.e. that you could get when calling the method with appropriate arguments). Statements that no longer branch due to this simplification can be viewed as normal non-branching statements.
3. Calculate the Cyclomatic Complexity of the method. If necessary, supplement the CFG from part 1b.2 with additional required elements. Give the complete calculation method! (TAKE THE VALUES FROM THE GRAPH AND CALCULATE IT)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!