One of the things I've been toying with as of late is moving the distinctPixel.com hosting from their (*ahem* bloody expensive *ahem*) dedicated Windows 2000 server(s) to a more budget level unix hosting solution. $300/mo vs. $9/mo is an amazing difference—and one that I just can't quite seem to overlook. Of course, the big hurdle in doing this is that I completely lose the ability to run ASPNET, ColdFusion, and MSSQL Server 2000… the three platforms that I've always written to.
"But Barclay!", you cry, "You're forgetting about PHP, MySQL (it's got stored procedures now) and RubyOnRails! And hell, all the cool web 2.0 kids are using ROR!"
Alright… Alright. I'll take a sip of your koolade.
So, I took the plunge. I installed PHP5, MySQL5, and ROR 1.2 on my aging 12" powerbook.
First, let's start by talking about the distinctPixel.com site. It is is extremely simple: mainly an exercise in templating, with a small amount of DB access (the news section on the home page—which is 4 years old, and the portfolio section), then a little disk access and session handling (for client downloads) and reading and writing a signed cookie (when you're logged in). Not rocket science.
So, I decided to rewrite it in PHP and MySQL.
First thing out of the gate: The interaction with the MySQL class was so fucking ridiculous that I ended up writing a wrapper object to make MySQL operations a little cleaner and more object oriented (not to mention readable). Of course, once I finished writing this, I stumbled up a whole separate MySQL Improved class… what the fuck? This was starting off on a bad way.
So, I did what any good little developer would do, and I went to the documentation. Now, perhaps comparing PHP's documentation to C# is unfair. Microsoft has a gizillion dollars, and can pay lots and lots of professional techwriters to come in and do really solid docs. PHP's documentation, however, seems downright amateur. Often times the threads at the bottom become exercises in pissing contests. I actually found myself using google rather than their docs, where I would find the answer that I was looking for squirreled away in someone's blog.
The rest of my implementation went about the same way. And don't even get me started on session handling in PHP. Seriously. It's fucking retarded.
It feels like they've (Zend, the PHP contributors, or whomever) crammed so much into PHP that they've forgotten to make sure the platform makes sense. It has support for sockets, but the XML parsing is ridiculously lame. How does that work?
Someone needs to come in with a pretty sharp knife, and take a serious look at what needs to be depreciated, and then just start cutting old shit out. Short tag syntax (= >) shouldn't be an option, it should just be. Make A MySQL class, and kill both the old lame one AND the MySQLi class. Yes, it's gonna break people's form applications, but so it goes. Cruft is nobody's friend.
They should also seriously take a look at all of those string methods, and their terrible naming conventions. A bunch of them are str_foo() while the rest are strfoo(). Come on, guys… this screams rookie!
Anyway. Enough of my bitching. It's written… it's done… And it's unlikely that I'd ever choose PHP as a platform again.
I'll attempt in the next week or two to start porting this site (distinctPixel.org) in ROR, and will let you know how that goes…
Recently, I've come across a number of articles talking about problems with the LAMP talent pool, and some of the future predicaments of PHP. Since I recently started a new job that works entirely in PHP, I thought I might add my 2¢.
Many of these articles talk seem to point to academia as part of the problem. That the CS courses are all teaching Java/C++/C# (and not PHP), and they correlate that to a lack of genuine talented PHP devs out there. But I don't think that's entirely it.
A commenter on one of these posts says:
PHP has a good learning curve. I think most Java people can do PHP within 3 weeks. PHP people can't do JAVA in 3 weeks (most of them).
Which I think comes closer to it. Most Java, or traditional CS trained devs should be able to pick up PHP pretty quickly. The language and constructs in PHP aren't anything different or new; it's just a matter of remembering the names and signatures of the methods, and keeping track of the syntax subtleties. As an average C# guy, I was able to whip together a small web application over a weekend (before interviewing with the new gig).
But here's the thing… and I think this is the bit that the above comment almost hit: as a C# developer, there would be no reason for me to ever want to build anything in PHP—when given the choice. For me, there's no itch that it would scratch. To kill a metaphor: the grass doesn't even appear greener on that side of the fence.
If, left up to my own devices, I decided I wanted to work with something open source (and not pay the dreaded microsoft tax), I'd be much more apt to look into Python, or another language that's different, interesting, or had a lot to offer (Ruby, Smalltalk, etc). PHP, while light weight and absolutely functional, comes across as downright sloppy. And, since I'm just a developer (not an architect, CTO, or ops guy), writing good, clean, or interesting code is what really gets me off, not arguments of TCO, or scalability (all of which may be where PHP wins the most).
And I think that's the crux of it. There are plenty of talented devs out there that could work just fine in PHP (I am)… but PHP's biggest obstacle is the language, itself.