Tuesday, March 17, 2015

Defending PHP

Yesterday, the developers of the ownCloud project posted a great blog entry explaining why ownCloud chooses to use PHP instead of one of the 'sexier' languages like Ruby on Rails or Node. Overall, I agree with their defense. There's nothing particularly wrong with PHP, despite what we keep being told by the independent developer elite. Sure, PHP has its quirks and it's got it's fair share of 'gotcha' issues that can bite an unfamiliar developer in the ass, but so does every language including the darlings of Internet development.
language like Ruby on Rails or Node. Overall, I agree with their defense. There's nothing particularly

Bad code isn't produced by programming languages. Bad code is produced by bad programmers. I've seen some absolute monstrosities written in Java, C#, Python, and dozens of other languages by developers who never really took the time to learn their tool because they were too busy chasing the hot new language on the block. Likewise, I've seen some amazingly elegant code written in PHP, written by developers who'd taken the time to learn the language and stick with it instead of jumping around when the elite of the development world start saying their language isn't cool anymore. Those developers get a cursory glance (maybe work through a book in a weekend) and never cozy up to the language to learn its curves.

I'm not saying PHP is perfect - it's certainly not. But no language is perfect. If you talk to any serious developer they can likely name a dozen annoyances about whatever their language of choice is. They keep using that language because they've taken the time to learn it. They know what to expect from the language and have embraced it. PHP developers, the good ones anyway, have done the same.

Want to stop writing bad and kludgey PHP code? Stop being a bad programmer. Take time to learn the language, massage its warts, and embrace its differences. You'd be surprised how much more productive you'll be and how much more elegant your code will become.