I’m sure I’m not the only person who has been talking about this, but the response to Derek Sivers talking about how he switched back to PHP after 2 years of trying to rewrite CD Baby using Rails has been so predicatably idiotic. He even hired a Rails expert to help him out. Not what I would’ve done, but whatever. So, he had the courage at some point to pull the plug on it and got down to work rewriting his app in PHP. 2 months and 10K lines of code later, he was done. 2 years vs. 2 months.
Now, other people have done a much better job of deconstructing the childish, immature responses that basically seem to imply that Mr. Sivers’ is an idiot (which he clearly is not) and that Rails is perfect and that he must be doing something wrong. But that’s not what I’m here to discuss today. His experience is not atypical in the software industry. Many have been seduced by the promise of a new tool and have failed to anticipate that some of the same problems they were hoping to fix were going to show up no matter how hard they tried. And woe unto anyone who chooses to criticize that technology, as they will be flamed mercilessly for not accepting that the new is better than the old.
Anyway, the guy I feel bad for is the Rails expert Mr. Sivers’ hired. He was being asked to shoehorn an existing application into not only a new language but probably a new paradigm. Was the old CD Baby a prime candidate for a rework using a framework that relies heavily upon convention over configuration in order to gain development time? Legacy apps are very hard to rewrite when you didn’t create the original. Sure, Mr. Sivers was helping the Rails guy out but there was no way he (the Rails guy) could get this done. Mr. Sivers just knew way too much about all the hackery that inevitably creeps into an app to get it to work and no amount of time could get that info out of his head and into a form that Rails Guy could use.
Of *course* Mr. Sivers could rewrite this thing in 2 months. He knew all the intimate details. How could he *not* succeed? He had thrown away 2 years worth of work but was able to get it done in 2 months by himself. All he really had to do was go back and recognize the mistakes he had made and what was the simplest way to implement the functionality he had already written before. But here’s the kicker: he knew how do it better BECAUSE of what he learned while doing Rails.
As I told my friend Kevin, the end result of all my talks on “What can PHP learn from Ruby on Rails” was me being able to stand up and say “there is nothing I can’t build in PHP that I can build in Rails, but thanks for showing me all those best practices.” That, my Rails fan boys, is the real lesson to be learned. Keep all that “PHP is ugly, Ruby is beautiful” nonsense to yourself and just build something with it. I’ll be humming along building PHP sites using all those cool things I learned from Rails. You want to use Rails? Great! I’ll be here working on my PHP stuff, let me know when you run into an application-level problem Rails can’t solve because I’m willing to bet it’s been solved with PHP. Numerous times.