PHP and Technical Debt

For many developers, PHP and Technical Debt are synonymous. After all, at some point in our career, we’ve suffered at the hands of some dimwit developer who left us possibly the worst code in the world to maintain. Code for which no documentation exists, or could exist. Code with loops within loops and functions calling other functions in return statements until your brain starts crawling out of your ears . . . you get the idea.

Generally there’s no evidence to prove that PHP has produced bad code, but the creators of the wonderful Symfony framework might have something to say about it. In 2014, Sensio Labs (the company behind the Symfony framework), performed a technical debt analysis on popular PHP projects. And here’s what they found:

WordPress sits at the top of the mountain, with 20.1 years. What does this mean? This means that if WordPress were to be rewritten today to reflect good coding practices, it would take 20.1 man-years to do it. That’s quite bad, isn’t it?

Down the chain are Symfony itself, as well as the Composer project, that have technical debt of a 4-8 weeks.

Should we conclude from this that PHP is the worst language ever? Not really. If a similar analysis were carried on enterprise-level Java projects, for example, I’m sure similar picture will emerge.

Should we then say that WordPress totally, absolutely sucks? Yes, but there’s a qualification to that, as noted by Sensio Labs:

[. . .] project age is a determining factor in its quality. WordPress and phpBB were released more than 10 years ago, before most of the modern PHP features were available. This put those projects in a competitive disadvantage over other more modern applications such as Composer or Doctrine.

In other words, these projects were developed at a time when OOPS was not well known in PHP, there were several warts and bugs in the language itself, etc. In other words, these frameworks suck because PHP in that time sucked.

Leave a Reply

Your email address will not be published. Required fields are marked *