Tuesday, March 15. 2011A brief introduction to the Coupling Between Objects metricIn this blog post I will give you a brief introduction into the Coupling Between Objects metric, that is one of the metrics calculated by the static code analysis tool PHP_Depend. The Coupling Between Objects or CBO metric was originally defined by Chidamber & Kemerer in their IEEE paper "A Metrics Suite for Object Oriented Design" [1]. This software metric represents the number of other types a class or interface is coupled to. The CBO metric is calculated for classes and interfaces. It counts the unique number of reference types that occur through method calls, method parameters, return types, thrown exceptions and accessed fields. But there is an exception for types that are either a subtype or supertype of the given class, because these types are not included in the calculated CBO value. Excessive coupled classes prevent reuse of existing components and they are damaging for a modular, encapsulated software design. To improve the modularity of a software the inter coupling between different classes should be kept to a minimum. Beside reusability a high coupling has a second drawback, a class that is coupled to other classes is sensitive to changes in that classes and as a result it becomes more difficult to maintain and gets more error-prone. Additionally it is harder to test a heavly coupled class in isolation and it is harder to understand such a class. Therefore you should keep the number of dependencies at a minimum. ThresholdsBased on their research Sahraoui, Godin and Miceli [2] suggest a maximum CBO value of 14, because higher values have negative impacts on several quality aspects of a class, which includes the maintainability, stability and understandability. See also
Bibliography
Posted by Manuel Pichler
in php, php_depend, phpugdo, planet-php, projects
at
11:59
| Comment (1)
| Trackbacks (0)
Defined tags for this entry: cbo, coupling between objects, php_depend, quality assurance, software metrics
Monday, February 28. 2011PHP_Depend 0.10.2 releasedWe are proud to announce release 0.10.2 of PHP_Depend. Beside two bug fixes this release implements four new software metrics:
A detailed CHANGELOG can be found on the project's download page and a complete, detailed description of the newly implemented software metrics in PHP_Depend's metric catalog.
Posted by Manuel Pichler
in php, php_depend, planet-php, projects
at
11:25
| Comments (0)
| Trackbacks (0)
Friday, February 25. 2011Brief introduction to the Class Interface Size metricThis blog post will give you a brief introduction into the Class Interface Size metric, as it is calculated by the static code analysis tool PHP_Depend. The Class Interface Size or CIS metric is measure of the public services that a class provides. This metric was orginally defined in the QMOOD model [1] by Bansiya & Davis. The orginal version of the CIS metric was defined as the number of public methods that a class provides. Each of these methods can be seen as a service where surrounding application can send messages to or receive messages from a class. CIS = public(NOM) A newer variant of the CIS metric also includes the public attributes of a class, because theses properties can also be used to transport messages or information between a class and the surrounding application. CIS = public(NOM) + public(VARS) PHP_Depend uses the second variant and counts all public methods and attributes declared in a class to calculate its Class Interface Size metric. This metric is a good indicator for the choosen software design. Several classes with a high CIS value are a sure sign that the design of the analyzed software prefers composition over inheritance to share common functionality between different components. So in most cases a high value is a good a sign, because composition increases the reusability and flexibility. But there are also situations where wrongly used composition of functionality leads to a design that is harder to understand and maintain. Thresholds
It is not easy to define good thresholds for this metric, because those values
heavy depend on the choosen design, e.g. inheritance or composition. But in
generall we can say that is best practice to limit the public interface that
can be used to alter the internal state of an object. Therefore we suggest
Bibliography
Saturday, June 19. 2010PHP_Depend 0.9.16 bugfix releaseToday/Yesterday we have released the bugfix version 0.9.15 and 0.9.16 of PHP_Depend. With these releases we have closed a critical bug in PHP_Depend's handling of namespaces, where identical class names in two different namespaces resulted in an endless loop, so that the php process died with a fatal error.
As always, you can get the latest PHP_Depend version from its PEAR channel: pear.pdepend.org: mapi@arwen ~ $ pear channel-discover pear.pdepend.org mapi@arwen ~ $ pear install pdepend/PHP_Depend-beta Or you can fetch the sources from the subversion reposition: mapi@arwen ~ $ svn co http://svn.pdepend.org/trunk pdepend And additionally you can find a repository mirror on github: mapi@arwen ~ $ git clone git://github.com/manuelpichler/pdepend.git
Posted by Manuel Pichler
in php, php_depend, phpugdo, projects
at
13:07
| Comments (0)
| Trackbacks (0)
Wednesday, May 12. 2010Artikel zum Thema SoftwaremetrikenThis blog post is in German as the mentioned article was published in German.
In der heute erschienenen Ausgabe 4.10 des PHP Magazins ist auch ein Artikel von mir enthalten, und wie sollte es wohl anders sein *Trommelwirbel*, beschäftigt der sich mit dem Thema Softwaremetriken Über Kommentare, Anregungen und Kritik rund um den Artikel würde ich mich sehr freuen. Und sollte euch der Artikel gefallen haben, empfehle ich die Internationale PHP Conference 2010, die vom 30. Mai bis 2. Juni in Berlin stattfindet, an der ich teilnehmen und zwei Vorträge halten werden.
Posted by Manuel Pichler
in php, php_depend, phpmd, phpugdo, phpundercontrol, projects, staticReflection
at
09:04
| Comments (0)
| Trackbacks (0)
PHP-Magazin Artikel zum Thema SoftwaremetrikenThis blog post is in German as the mentioned article was published in German.
In der heute erschienenen Ausgabe 4.10 des PHP Magazins ist auch ein Artikel von mir enthalten, und wie sollte es wohl anders sein *Trommelwirbel*, beschäftigt der sich mit dem Thema Softwaremetriken Über Kommentare, Anregungen und Kritik rund um den Artikel würde ich mich sehr freuen. Und sollte euch der Artikel gefallen haben, empfehle ich die Internationale PHP Conference 2010, die vom 30. Mai bis 2. Juni in Berlin stattfindet, an der ich teilnehmen und zwei Vorträge halten werden.
Posted by Manuel Pichler
in php, php_depend, phpmd, phpugdo, phpundercontrol, projects, staticReflection
at
09:04
| Comments (0)
| Trackbacks (0)
Monday, May 10. 2010PHP_Depend 0.9.13 bugfix releaseToday we have released the bugfix version 0.9.13 of PHP_Depend, the tool
to measure several software metrics for your PHP application. This release
fixes two critical bugs. One in the tokenizer implementation, which has
modified valid code under test in such a way, that it has become invalid
PHP code. The second fix is related to PHP_Depends's test code, where a
missing
As always, you can get the latest PHP_Depend version from its PEAR channel: pear.pdepend.org: mapi@arwen ~ $ pear channel-discover pear.pdepend.org mapi@arwen ~ $ pear install pdepend/PHP_Depend-beta Or you can fetch the sources from the subversion reposition: mapi@arwen ~ $ svn co http://svn.pdepend.org/trunk pdepend And additionally you can find a repository mirror on github: mapi@arwen ~ $ git clone git://github.com/manuelpichler/pdepend.git
Posted by Manuel Pichler
in php, php_depend, phpugdo, projects
at
17:31
| Comments (0)
| Trackbacks (0)
Thursday, April 29. 2010Goodbye CologneAs many of you may already have noticed, there will be a big change in my career as a professional software engineer and architect this summer. Together with Kore and Toby I am in the process of founding a company. The focus of this company will be on services all around the whole quality life cycle in PHP projects. Under the hood of our company we will also offer support, trainings and consulting for several quality assurance tools, like pdepend, phpmd and phpUnderControl. For you, this opens a great opportunity. You can use the tools and the documentation, as well as participate in the community, as usual. But from now on you can also purchase professional support, if you get stuck or need general assitance. And when you miss a feature or need an individual extension for one of these tools, don't hesitate to contact us. I am really excited what cool things will happen in the next couple of years and I am looking forward to cowork with professionals like Toby and Kore. To finalize the little marketing for the company and its services
Posted by Manuel Pichler
in php, php_depend, phpmd, phpugdo, phpundercontrol, planet-php
at
13:20
| Comments (3)
| Trackbacks (0)
Defined tags for this entry: changes, company, consulting, php, phpmd, phpundercontrol, php_depend, quality, support, training
Sunday, April 25. 2010PHP_Depend 0.9.12 releaseI am proud to announce the 0.9.12 release of PHP_Depend. PHP_Depend is a low level static code analysis tool. It takes the given source and calculates several software metrics for the code. This data can be used by software-developers, architects and designers to control the quality of a software-product without time consuming code audits. This new release of PHP_Depend has done a great step into the direction of a token free PHP_Depend version. This means future versions of PHP_Depend will work without the need to traverse linear token streams up and down, to measure metrics. Instead PHP_Depend will rely on it's internal abstract syntax tree, that represents the logical structure of the analyzed source code. With this solution it will be possible to implement several new features that will make PHP_Depend more useful, for example static callgraph analysis.
As always, you can get the latest PHP_Depend version from its PEAR channel: pear.pdepend.org: mapi@arwen ~ $ pear channel-discover pear.pdepend.org mapi@arwen ~ $ pear install pdepend/PHP_Depend-beta Or you can fetch the sources from the subversion reposition: mapi@arwen ~ $ svn co http://svn.pdepend.org/trunk pdepend And additionally you can find a repository mirror on github: mapi@arwen ~ $ git clone git://github.com/manuelpichler/pdepend.git
Posted by Manuel Pichler
in php, php_depend, phpugdo, projects
at
14:44
| Comments (0)
| Trackbacks (0)
Tuesday, March 2. 2010PHP_Depend-0.9.11 releasedI have just released version 0.9.11 of PHP_Depend. It contains a few bug fixes and improvements for PHP_Depend.
As always, you can get the latest PHP_Depend version from its PEAR channel: pear.pdepend.org: mapi@arwen ~ $ pear channel-discover pear.pdepend.org mapi@arwen ~ $ pear install pdepend/PHP_Depend-beta Or you can fetch the sources from the subversion reposition: mapi@arwen ~ $ svn co http://svn.pdepend.org/branches/0.9.0/ And additionally you can find a repository mirror on github: mapi@arwen ~ $ git clone git://github.com/manuelpichler/pdepend.git
Posted by Manuel Pichler
in php, php_depend, phpugdo, projects
at
21:08
| Comments (0)
| Trackbacks (0)
Defined tags for this entry: bug fix, php_depend, release announcement, software metrics, static code analysis
Tuesday, February 23. 2010PHP_Depend-0.9.10 releasedI have just released the bug fix version 0.9.10 of PHP_Depend. This release contains several bug fixes and improvements for PHP_Depend.
As always, you can get the latest PHP_Depend version from its PEAR channel: pear.pdepend.org: mapi@arwen ~ $ pear channel-discover pear.pdepend.org mapi@arwen ~ $ pear install pdepend/PHP_Depend-beta Or you can fetch the sources from the subversion reposition: mapi@arwen ~ $ svn co http://svn.pdepend.org/branches/0.9.0/ And additionally you can find a repository mirror on github: mapi@arwen ~ $ git clone git://github.com/manuelpichler/pdepend.git
Posted by Manuel Pichler
in php, php_depend, phpugdo, planet-php, projects
at
20:36
| Comments (0)
| Trackbacks (0)
Defined tags for this entry: php, php5, php_depend, quality assurance, release announcement, software metrics, static code analysis
Tuesday, December 29. 2009PHP Mess Detector 0.2 released.Today I have released version 0.2.0 of the PHP Mess Detector or short PHPMD. PHPMD is a simple, customizable and user friendly frontend application for PHP_Depend. It takes the raw metrics measured by PHP_Depend, compares them with appropriate thresholds and generates a report that lists those software artifacts with potential problems. Such a report can be taken as a basis for human code audits or you can use it as input for an automated build/reporting tool. Most concepts behind PHPMD are based on those of the well known Java Tool PMD. It uses so called rule set files to organize different sets of rules. There are two purposes that are accomplished by these xml files. The first is to create custom sets of rules which fulfills the projects requirements. The second purpose is the configuration of each rule with thresholds, warning messages and other things. The format of these files is totally borrowed from PMD, so that the reuse existing rule sets in multi language environments should be easy. At the moment PHPMD has two build-in rule sets. One that detects software artifacts with high code size, and the second one detects unused code in your software.
Now lets start with a small How to use it. PHPMD can be called from the command line by typing mapi@arwen ~ $ phpmd Mandatory arguments: 1) A php source code filename or directory 2) A report format 3) A ruleset filename or a comma-separated string of ... Optional arguments that may be put after the mandato... --minimumpriority: rule priority threshold; rules with ... --reportfile: send report output to a file; default to ... --extensions: comma-separated string of valid source ... --ignore: comma-separated string of patterns that are ...
Now let's call PHPMD on its own source, with a simple text report on STDOUT and the mapi@arwen ~ $ phpmd ~/phpmd/source text codesize /home/mapi/phpmd/source/PHP/PMD/RuleSetFactory.php:66 \ This class has too many methods, consider refactoring it. /home/mapi/phpmd/source/PHP/PMD/RuleSetFactory.php:267 \ The method _parseSingleRuleNode() has a Cyclomatic \ Complexity of 11. /home/mapi/phpmd/source/PHP/PMD/RuleSetFactory.php:326 \ The method _parseRuleReferenceNode() has a Cyclomatic \ Complexity of 10.
The
mapi@arwen ~ $ phpmd ~/phpmd/source xml codesize,unusedcode \
--reportfile ~/pmd.xml
mapi@arwen ~ $ cat ~/pmd.xml
<?xml version="1.0" encoding="UTF-8" ?>
<pmd version="@package_version@" timestamp="...">
<file name=".../source/PHP/PMD/RuleSetFactory.php">
<violation beginline="66" endline="417" rule="TooManyMet ...>
This class has too many methods, consider refactoring it.
</violation>
<violation beginline="267" endline="315" rule="Cyclomati ...>
Method _parseSingleRule() has a Cyclomatic Complexity of 11.
</violation>
<violation beginline="326" endline="367" rule="Cyclomati ...>
Method _parseRuleReference() has a Cyclomatic Complexity of 10.
</violation>
</file>
</pmd>
This xml file is compatible with those files generated by PMD and PHPUnit's deprecated
Currently PHPMD supports the following three different report formats: Text, HTML and XML. And it has the build-in rule sets: You can get the latest PHPMD version from its PEAR channel: pear.phpmd.org mapi@arwen ~ $ pear channel-discover pear.pdepend.org mapi@arwen ~ $ pear channel-discover pear.phpmd.org mapi@arwen ~ $ pear install --alldeps phpmd/PHP_PMD-alpha
Posted by Manuel Pichler
in php, php_depend, phpmd, phpugdo, planet-php, projects
at
23:40
| Comments (2)
| Trackbacks (0)
Saturday, December 26. 2009PHP_Depend-0.9.9 releasedI have just released the bug fix version 0.9.9 of PHP_Depend.
You can get the latest PHP_Depend version from its PEAR channel: pear.pdepend.org mapi@arwen ~ $ pear channel-discover pear.pdepend.org mapi@arwen ~ $ pear install pdepend/PHP_Depend-beta
Posted by Manuel Pichler
in php, php_depend, phpugdo, projects
at
23:26
| Comments (0)
| Trackbacks (0)
Monday, December 14. 2009PHP_Depend-0.9.8 releasedToday I released PHP_Depend 0.9.8, which contains many bug fixes and improvements. This release will be the base version for a new tool called PHPMD. PHPMD is a frontend that reports critical and suspect software artifacts in a project, based on the metrics measured with PHP_Depend. It aims to be a PHP equivalent to the well known java tool PMD.
You can get the latest PHP_Depend version from its PEAR channel: pear.pdepend.org mapi@arwen ~ $ pear channel-discover pear.pdepend.org mapi@arwen ~ $ pear install pdepend/PHP_Depend-beta
Posted by Manuel Pichler
in php, php_depend, phpugdo, projects
at
17:21
| Comments (0)
| Trackbacks (0)
Saturday, November 28. 2009PHP_Depend PEAR Channel switched to Pirum
Today Fabien Potencier announced the first relase of the PEAR Channel server Pirum. The great benefit of this Channel server is that it provides a simple shell script to publish new PEAR package releases, a feature that I missed in the previously used Chiara PEAR Server. Pirum will make it really easy to publish new package versions through a simple build script
The setup was quick done, following the instructions on the pirum website, and importing the existing package files worked like a charm. The only problem I encountered was that both channel server implementations use a different directory structure. Pirum stores all the XML descriptors under a directory named /rest, while my Chiara Server installation has used /Chiara_PEAR_Server_REST, so that a first call to manu@arwen ~ $ pear upgrade Error getting channel info from pear.pdepend.org: \ File http://pear.pdepend.org:80/Chiara_PEAR_Server_REST/p/packages.xml \ not valid (received: HTTP/1.1 404 Not Found) But a simple 301 redirect makes this software transition transparent for the PHP_Depend users. So when you will also switch to Pirum you should keep this in mind and test your channel server with an existing/configured local pear installation. Finally, thanks to Fabien for this nitty-gritty tool, which will speed up the deployment process of PEAR packages, at least for me.
Posted by Manuel Pichler
in php, php_depend, phpugdo, planet-php
at
14:00
| Comments (3)
| Trackbacks (0)
(Page 1 of 3, totaling 36 entries)
» next page
|
ProjectsFurther stuffCategories |

