Internet Strategy Guide

tekx – continuous inspection and integration of PHP projects

by on May.19, 2010, under php, phptek, tekx

“Countinous Integration is about preventing your developers from burning in Integration Hell” – @s_bergmann

Integration Hell

My code is perfect, yours is pretty good and then Martin…well, he’s a fucking idiot. (lost where he was going with this story). D=

Team member should integrate their work frequently. This reduces errors when managing multiple team members. The value (ROI) is in:

  • reducing risk
  • reduce repetitive processes
  • generate deployable software
  • enable better project visibility
  • establish greater product confidence
  • helps with late discovery of defects
  • prevents low quality software
    • coding standard adherance
  • prevents lack of deployable software

This practice focuses on software design that uses unit tests to prevent and detect defects. This all significantly works to provide significantly better quality software.

How do we implement it

We need build automation.

You start by identifying repetitive processes (running tests, analyzing source code, packaging, deployment). You want to make these processes a non-event.

Static code analysis

Lines of code gives a text-based metric for code size.

  • Lines of code (loc)
  • comment lines of code (cloc)
  • non-comment lines of code (ncloc)
  • executable lines of code (eloc)

Code duplication. Is it textually identical? token for token identical? functionally identical? Dupicate code contradicts code reuse. Co-Evolution of clones hinders maintenance. There is a tool called PHPCPD (a copy-paste detector). Highest they’ve seen is 16% duplication in a code base of 5 million lines of code.

code complexity

Cyclomatic complexity counts the number of branching points such as if, for,foreach,while,case,catch,&&,””,ternary operatory. NPath Complexity counts the number of execution paths. Higher complexity leads to more errors and makes testing harder.

You can analyze code with “sniffs”.

build automation

  • apache ant
  • gnu make
  • phing
  • rake
  • shell scripts

Reviewing some of the tools that got covered in another talk I blogged about. If anything new/interesting is added, i’ll list it. @s_bergmann recommends Hudson (http://hudson-ci.org). Apparently very easy to use and is used by some big names like Sun.

Reblog this post [with Zemanta]
:, , , , , ,

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!