The real problem with PHP


A few mornings ago a discussion was started around PHP and it’s problems. This discussion was based on the following article:

http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/

There were 2 camps, the camp who agreed with the article and that PHP was terrible and the camp that agreed with the article but felt PHP did it’s job and the article was just complaining for the sake of it.

The discussion wasn’t really making progress and just consisted of a disagreement and the ‘Pro PHP Camp’ saying that it does it’s job even though it’s flawed and thats not a good enough reason to hate PHP.

I read the article and while I agree with what the Author is saying I don’t believe they explained the real world outcome of the languages peculiarities, and that actually the ‘Pro PHP Camp’ had a point, it’s flawed but it works. I then expressed my feelings on PHP and the ‘Pro PHP Camp’ agreed that my argument was better, so i’ve decided to document my reasoning why PHP is a major problem.

First PHP is┬ávery easy to setup and code for a beginner to produce something simple, but half decent, it’ll be buggy in places but it’ll work. Now if you read the linked article you will see that PHP is full of all sorts of special language features, as you take the simple PHP script a beginner would write and start doing complex tasks the developer would need to know every single one to write bug free code.

And this is where the actual problem with PHP lies. Essentially as a language it is so inconsistent and has so many unknown or unexpected behaviours from even the most basic functionality that it makes experienced developers look like beginners.

This results in buggy code, not because it’s badly written or designed, but because the developer didn’t check for all the different unusual variations that the core PHP functionality they are using might throw at them. The developer might not know about this as it’s not documented, or they might have forgotten about one eventuality. In the end the developer usually finds out about this when their users start reporting errors, or they get garbage in their database.

Despite how experienced the developer is these will errors will always slip in, because we are human and because there is so much weirdness to remember sometimes you just forget. Eventually most good developers figure this out and abandon PHP for a language that doesn’t make them feel stupid twice a week, and that includes me.

As I said at the start I don’t think trying to break down all of PHP’s problems individually gets the message across especially well and people will just put you down as a moaner, instead I believe this is a better explanation of the problem which more people including PHP developers will understand.

, , ,

  1. No comments yet.
(will not be published)