% fortune -ae paul murphy

Learning from failure

Another list of seven, this one Derek Silver's 7 reasons I switched back to PHP after 2 years on Rails drew some fascinating comments from its audience over at O'Reilly's.

The story itself was about his failure to rewrite an estimated 90,000 lines of PHP code for his cdbaby.com site using Ruby on Rails and subsequent success in reducing everything to 12,000 lines of "beautiful" new PHP. Here's his summary (from the comments, not the story) of what those 12,000 lines do:

Our entire operation, managing digital distribution to 150 outlets like iTunes, international credit card sales and merchandising, accounting and weekly payments to 200,000 musicians with transparent accounting, a 50-person warehousing and shipping system that sends and receives thousands of boxes a day, a members login area that lets them administer our site, set their digital rights, see all accounting, our entire customer service intranet, and digital rights management in-house...

Another comment nicely summarizes the story itself:

He writes that he was inspired by Ruby, and after it failed to meet his needs, he realized he was looking at PHP as a crappy language, when the reality was that he was such a better programmer than when it was written, and how he made a mistake thinking he needed to switch from PHP to Ruby, when all he needed to do was clean up his old code he wrote when he knew so much less.

The interesting stuff, however, comes from people who look at what he reports and draw generic "lessons learned" summaries from that. Here for example, is a comment by "Marcus":

So many comments and not a single one to point the Zend Framework for PHP5?

I'm a developer with 12 years experience, 7 years of PHP, and I can't code without it anymore. It just takes care of so many rudimentary tasks. Provides MVC, DB abstraction (you can still write your own SQL), Zend_View (templates that makes sense, unlike Smarty), offers classes for almost anything and everything, and it's extremely well thought out. It's quite beautiful because it's so light-weight.

Now, I don't want to come across as some kind of rails hater, because I certainly am not. I'm having a really hard time believing that RoR is to blame for the project failure. I've seen people drag tush with PHP projects as well. And often that's because the developer spends time and time beautifying their code. They add comments, make sure everything is indented, look at the same file over and over and try to figure out whether there isn't another design pattern or three that they can refactor their code with. They simply worry too much about the code rather than the project as a whole and the user (who never sees the code) experience.

Bottom line for me is: Use the best tool for the job that you're familiar with. For me that's PHP+ZFW, because I know it. For a few developers on another team in our company it's RoR.

And that, for me, was lesson one: what's important isn't which tool is intrinsically better, it's which tool lets you do better work. In his place I would probably have used Zend and stolen some open source bits for things like the accounting and trading processes, but the message here is that what counts is the combination of programmer plus toolset plus requirements, not just the toolset -really that programmers are far less interchangeable than either problems or programming toolsets.

The most interesting comment however, and the reason I choose to write about this, came from somebody signing himself as "Nate." Here's the whole thing:

Haha. The CD Baby website kicks ass.

It works, it makes it easy to navigate through the thousands of albums they have. They have reviews. It's nice, simple, and easy to use.

Plus it does not suck up my computer's resources with javascript hell like most 'Web 2.0' websites do (big example: Digg.com is absolutely horrible design). Plus it's very handicap accessable, which Web 2.0-style sites totally fuck up at.

Plus it's not flash-site hell. Most 'web 2.0'-sites that manage to avoid javascript hell the run headlong into flash hell.

No flash-based little bars to play music or other nonsense I have to go through. Just hit 'listen broadband' button and I get a m3u file that opens right up into Totem player.

That's nice.

The only change I could recommend is to hire a artist, a real artist in the visual arts and not some javascript or website hacker, (preferably somebody with very little knowledge in any markup or scripting language that does art with real materials) to make a design for the the first page more sophisticated looking. (no aninations/columns/blogs or any such nonsense)

I don't know if it's true or not. But the general impression of the comments on this page reek of snobbishness.

And I don't remember for certain, but I once heard a very good developer say: "Objected languages can end up a crutch for people who can't think in a object oriented manner".

That is C or PHP or anything else can take advantage of code reuse and objects as well as C++ or Java or anything else. It just requires more skill and ingenuity then it would otherwise normally take.

The only real thing I dislike, as far as PHP goes, is the security record, which is something that Apache suffers from also (compared to competitors like IIS6).

For PHP/Perl/Python/Ruby and Apache to recover ground it's lost to Microsoft it's going to take a lot more obviously (as in from the view of people outside these projects) focused effort on ease of use and security then what is going on right now.

Oh, well.

What he likes is that the site works as simply as reasonably possible - and wow does that resonate with me. Web 1 rocks - but web 2.0 could really be defined as consisting of those web sites, particularly those using AJAX and Flash, which suck resources for no apparent functional purpose.

And that, if I can add my own two bits on the story's original subject, is most likely the underlying reason Silver failed to get his Ruby on Rails project to completion: that toolset is largely for programmers whose values drive them to pimp rather simple rides, and neither he nor his website fit the profile.


Paul Murphy wrote and published The Unix Guide to Defenestration. Murphy is a 25-year veteran of the I.T. consulting industry, specializing in Unix and Unix-related management issues.