<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Sat, 22 Nov 2008 03:30:58 -0600</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Jacob Santos' Blog: What is your C.R.A.P. Index?]]></title>
      <guid>http://www.phpdeveloper.org/news/8406</guid>
      <link>http://www.phpdeveloper.org/news/8406</link>
      <description><![CDATA[<p>
In relation to a <a href="http://www.phpdeveloper.org/news/8388">recent announcement</a> from <i>Sebastian Bergmann</i> about the inclusion of Cyclometic Complexity testing in the upcoming <a href="http://www.phpunit.de">PHPUnit release</a>, <i>Jacob Santos</i> has <a href="http://www.santosj.name/programming/php-related/php/what-is-your-crap-index/">taken a look at its use</a> - find the <a href="http://www.artima.com/weblogs/viewpost.jsp?thread=210575">C.R.A.P.</a> of a process.
</p>
<blockquote>
The Change Risk Analysis and Predictions (CRAP) index is to give some idea how difficult it would be to maintain the code base. It is not to be used in evaluating how "beautiful" the code is.
</blockquote>
<p>
He had to modify things slightly in PHPUnit to get it to work with entire files/functions, but it was still simple to use the testing software to create each file's CRAP index. For his examples, he chose the WordPress code and includes the code he used for the tests - two functions: getCCLevel and getCrapIndex. The results of the report are <a href="http://www.santosj.name/programming/php-related/php/what-is-your-crap-index/">also included</a>.
</p>]]></description>
      <pubDate>Tue, 07 Aug 2007 11:57:00 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Sebastian Bergmann's Blog: PHPUnit and Software Metrics]]></title>
      <guid>http://www.phpdeveloper.org/news/8388</guid>
      <link>http://www.phpdeveloper.org/news/8388</link>
      <description><![CDATA[<p>
In a <a href="http://sebastian-bergmann.de/archives/689-PHPUnit-and-Software-Metrics.html">update to his recent post</a> on Cyclomatic Complexity in PHPUnit, <i>Sebastian Bergmann</i> has given more information about the software metrics support that the upcoming release (3.1.6) of <a href="http://www.phpunit.de">PHPUnit</a> will offer.
</p>
<blockquote>
The upcoming 3.1.6 release of <a href="http://www.phpunit.de/">PHPUnit</a> adds a couple of <a href="http://en.wikipedia.org/wiki/Software_metrics">software metrics</a> to the data that is stored in PHPUnit's <a href="http://www.phpunit.de/wiki/TestDatabase">test database</a>. 
</blockquote>
<p>
Among the metrics gathered are things like: lines of code, commented lines of code, an attribute inheritance factor, depth of inheritance tree, method hiding factor and a polymorphism factor (he links each of these more complex ones for more information on the subject). Still included in the post is an example of the output for the Cyclomatic Complexity metric. 
</p>]]></description>
      <pubDate>Fri, 03 Aug 2007 12:06:00 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Sebastian Bergmann's Blog: PHPUnit and Cyclomatic Complexity]]></title>
      <guid>http://www.phpdeveloper.org/news/8377</guid>
      <link>http://www.phpdeveloper.org/news/8377</link>
      <description><![CDATA[<p>
<i>Sebastian Bergmann</i> <a href="http://sebastian-bergmann.de/archives/689-PHPUnit-and-Cyclomatic-Complexity.html">mentions today</a> about a feature in an upcoming release of a popuular unit testing tool for PHP, <a href="http://www.phpunit.de/">PHPUnit</a> - the addition of more <a href="http://en.wikipedia.org/wiki/Software_metrics">software metrics</a>.
</p>
<blockquote>
The upcoming 3.1.6 release of <a href="http://www.phpunit.de/">PHPUnit</a> adds a couple of <a href="http://en.wikipedia.org/wiki/Software_metrics">software metrics</a> to the data that is stored in PHPUnit's <a href="http://www.phpunit.de/wiki/TestDatabase">test database</a>. Among these metrics is the <a href="http://en.wikipedia.org/wiki/Cyclomatic_complexity">Cyclomatic Complexity Number (CCN)</a>.
</blockquote>
<p>
An example of how the CCN works is <a href="http://sebastian-bergmann.de/archives/689-PHPUnit-and-Cyclomatic-Complexity.html">shown in the post</a> giving the className, methodName and the complexity ranking given for the combination. His example shows the rankings for a part of the eZ Components software.
</p>]]></description>
      <pubDate>Thu, 02 Aug 2007 07:56:00 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Jim Plush's Blog: Cyclomatic Complexity for the Test Driven PHP'er]]></title>
      <guid>http://www.phpdeveloper.org/news/5516</guid>
      <link>http://www.phpdeveloper.org/news/5516</link>
      <description><![CDATA[<p>
Unit testing in PHP applications is growing more and more in popularity, so much so that some developers get into it, test all of their code and aren't exactly sure when enough is enough. <i>Jim Plush</i> has <a href="http://www.litfuel.net/plush/?postid=137">a suggestion</a> for those kinds of testers - consider the cyclomatic complexity.
</p>
<quote>
<i>
<p>
It's one of the most common questions you ask when you first start using Test Driven Development or Unit Testing in general... When am I done?
</p>
<p>
It's the point you feel confident when all your tests exercise the code in your classes. How do I know when that point is? I've come across a new way of finding this point using something called cyclomatic complexity. Developed by Thomas McCabe in the 70's cyclomatic complexity is a simple measurement of how complex a piece of code is. One of the nice parts of it is that you can use it when working with unit tests.
</p>
</i>
</quote>
<p>
To illustrate, he <a href="http://www.litfuel.net/plush/?postid=137">gives a simple example</a> of a function with only a function call and return inside. This has a cyclomatic complexity rating of 1 (the lowest). Now, start adding in ifs, loops, and other ways for the data to go and you start adding more complexity levels. <i>Jim</i> suggests that this can be another useful unit testing measurement - one more unit test for each level of complexity.
</p>
<p>
He also notes a pleasant side effect of this sort of classification:
</p>
<quote>
<i>
The other nice part of a CC number is you can quickly find out when a method is ripe for refactoring. If you have a method with a CC number of 20 you know you most likely have a problem on your hand.
</i>
</quote>]]></description>
      <pubDate>Mon, 05 Jun 2006 14:45:55 -0500</pubDate>
    </item>
  </channel>
</rss>
