On platforms

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 rediculous.

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…

Feb 24, 2007

9:59 am

This entry has been tagged with:

GripesRuby on Railsphp