Results 1 to 3 of 3

Thread: Cyclomatic complexity

  1. #1
    Expert Member
    Join Date
    Apr 2006
    Answers
    124

    Cyclomatic complexity

    What is cyclomatic completxity?


  2. #2
    Expert Member
    Join Date
    Sep 2006
    Answers
    477

    Re: Cyclomatic complexity

    Purpose and Origin

    Cyclomatic complexity is the most widely used member of a class of static software metrics. Cyclomatic complexity may be considered a broad measure of soundness and confidence for a program. Introduced by Thomas McCabe in 1976, it measures the number of linearly-independent paths through a program module. This measure provides a single ordinal number that can be compared to the complexity of other programs. Cyclomatic complexity is often referred to simply as program complexity, or as McCabe's complexity. It is often used in concert with other software metrics. As one of the more widely-accepted software metrics, it is intended to be independent of language and language format [McCabe 94].

    Cyclomatic complexity has also been extended to encompass the design and structural complexity of a system [McCabe 89].

    Technical Detail

    The cyclomatic complexity of a software module is calculated from a connected graph of the module (that shows the topology of control flow within the program):

    Cyclomatic complexity (CC) = E - N + p

    where E = the number of edges of the graph

    N = the number of nodes of the graph

    p = the number of connected components

    To actually count these elements requires establishing a counting convention (tools to count cyclomatic complexity contain these conventions). The complexity number is generally considered to provide a stronger measure of a program's structural complexity than is provided by counting lines of code. Figure 6 is a connected graph of a simple program with a cyclomatic complexity of seven. Nodes are the numbered locations, which correspond to logic branch points; edges are the lines between the nodes.


    A large number of programs have been measured, and ranges of complexity have been established that help the software engineer determine a program's inherent risk and stability. The resulting calibrated measure can be used in development, maintenance, and reengineering situations to develop estimates of risk, cost, or program stability. Studies show a correlation between a program's cyclomatic complexity and its error frequency. A low cyclomatic complexity contributes to a program's understandability and indicates it is amenable to modification at lower risk than a more complex program. A module's cyclomatic complexity is also a strong indicator of its testability (see Test planning under Usage Considerations).



    A common application of cyclomatic complexity is to compare it against a set of threshold values
    Here's where I took it from,
    Cyclomatic Complexity

    Cheers,
    Kalayama

    [COLOR="Blue"][SIZE="2"]"If you are not living on the edge of your life, you are wasting space"[/SIZE][/COLOR]

    Someone says "Impossible is nothing". The man next him says "Let me see you licking your elbow tip!"

  3. #3
    Expert Member
    Join Date
    Apr 2006
    Answers
    124

    Re: Cyclomatic complexity

    That was an excellent article thank u


  4.  Sponsored Ads
    Ad


     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact