Talk:Essential complexity: Difference between revisions

Content deleted Content added
No edit summary
Line 16:
 
Same applies for the second example, it'd be nice to have an explanation as to "why" the complexity is more than 1. It's obviously a complex looking program, but that doesn't explain why it's an essential complexity.
 
== Cyclomatic complexity section is unrelated to the rest of the article. ==
 
It seems that this article discusses two '''completely unrelated ideas''' that share a name by coincidence.
 
The lead section discusses complexity which is inherent to a problem, i.e. that no degree of cleverness can eliminate.
 
However, the cyclomatic complexity section defines a metric of complexity which is anything but essential. [[Structured program theorem|Structured control flow is complete]]; any program written with a GOTO can be re-written using only structured control flow and '''without a GOTO.'''
 
Said another way, given any example program with an essential complexity>0, there is an equivalent program with essential complexity==0. The essential complexity metric measures something that is not essential to the problem. To demonstrate,
 
This original example seems complex because it contains GOTO statements:
for(i=0;i<m;i++) {
for(j=0;j<n;j++) {
if(z[i][j] != 0) goto non_zero;
}
goto found;
non_zero:
}
i = -1;
found:
 
That complexity is an illusion. The following code is equivalent and contains only structured control flow:
i=-1;
for(int ii=0; ii<m && i<0; ++ii)
{
i=ii;
for(j=0; j<n; ++j)
if( z[ii][j] != 0 )
i=-1;
}
 
'''I recommend that this subsection be torn out, and replaced with a 'See also Cyclomatic Complexity' '''
Thanks, [[Special:Contributions/140.180.249.29|140.180.249.29]] ([[User talk:140.180.249.29|talk]]) 16:48, 19 June 2014 (UTC)