Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Andrew Podner:
NPATH Complexity Demystified
Nov 14, 2012 @ 16:55:57

In a new post to his site today Andrew Podner takes a look at NPATH and tries to "demystify" some of the concepts around it.

“NPATH, which counts the acyclic execution paths through a function, is an objective measure of software complexity related to the ease with which software can be comprehensively tested.”[1] This is the definition from an article written in 1988 by Brian Nejmeh. As informative as this is, my eyes glazed over half way into it. So what the heck is acyclic execution anyway?

He defines the term in a bit easier to understand language and includes an example function to help illustrate how NPATH is measured.

The goal is to limit your NPATH complexity in a given method down to 200 or less. [...] As with other complexity metrics, this one can be checked with PHP Mess Detector (phpmd). The importance of staying under the 200 path threshold is realized when you develop tests and start trying to debug.
tagged: npath complexity cyclomatic introduction phpmd phpmessdetector

Link:

Volker Dusch's Blog:
Please ship your own coding standard as part of your project
Mar 14, 2011 @ 16:32:47

Volker Dusch has a suggestion for all of the PHP projects (or, really Open Source projects in general) that can help keep things cleaner in your codebase and make for simpler times when merging contributions - including your coding standard along with the rest of your project.

Let me elaborate on [an important] point: Contribution. Most developers i know care about producing good code, especially then they are contributing to an open source project! Those people will respect your coding standard, naming scheme and every thing else that they can check for before sending you all patch/pull request. So try to make that part easy.

He talks about doing things the hard way - reformatting everything by hand each time someone contributes - or the easier way of enforcing the coding standard as a part of the contribution flow. He mentions PHP_CodeSniffer and the PHP Mess Detector as a part of a Jenkins installation (easily built from this handy project).

tagged: coding standard phpcodesniffer phpmessdetector jenkins contribution

Link:


Trending Topics: