Alan Knowles shares with us six deadly PHP sins this week over on a new post from his weblog today.
This week, unfortunatly, I had to attack both the HAC and the Over engineered, (not on the same project thankfully). The problem with the HAC project was the end users had found a few minor bugs. There's bugs in all my software or features depending on how you look at it, but the difference between average and good programmers (IMO) is the ability to write code that someone else has a chance of understanding.
Fixing someone else's code is frequently the most annoying job that anyone with some intellegence has to do. It's one of those, pay the rent, scream and run around jobs. I'm sure other languages suffer as well, but thanks to PHP's learning curve, software written in the language often falls into 3 categories: Half a Clue (HAC), Reasonably worked out, and Over engineered.
And so, he lists several of these issues from this latest project, including:
- Untraceable code paths.
- Same code repeated in global scope
- Mixing PHP and HTML badly
- Global is almost as evil as eval()
I'll definintely agree with him on some of these - and I've been guilty of some of them as well. I'm a big fan of doing things "The Right Way" in an application (you know what I mean), but sometimes I get sloppy. I think it happens to every good programmer out there, no matter the experience level...




