Switching from Rails back to PHP?
Posted by Jon Lee in Ruby on Rails, Web Development, tags: PHP, Ruby on Rails, web development
This post is a response to Derek Siver’s post on the O’Reilly blog. Over two years ago, he decided to ditch a hundred thousand lines of messy PHP code in favor of rewriting his whole site with Ruby on Rails. Two years later, he isn’t even half done and has decided to go back to PHP. Just two months with PHP again and the project is complete.
He gives seven reasons of why he switched back to PHP after 2 years of unsuccessfully. I agree with some but not others. Here are his 7 reasons, you can read them in more detail on the original post.
- “Is there anything Rails/Ruby can do that PHP can’t do? … (thinking)… NO.â€?
- Our entire company’s stuff was in PHP: Don’t underestimate integration.
- Don’t want what I don’t need.
- It’s small and fast.
- It’s built to my tastes.
- I love SQL.
- Programming languages are like girlfriends: The new one is better because *YOU* are better.
Comparing Apples and Oranges
First of all, I would like to present the analogy of building a tree house. You can either build a tree house with precut pieces of wood and material (Ruby on Rails) or you can build a tree house by chopping down your own trees and making your own pieces (PHP).
Building a typical tree house is very easy with precut pieces. It is then just a matter of putting things together in the right order. However, if you wanted to deviate from a regular tree house and put in, say, an electric elevator, then you would have to find someone that has built something similar and copy it or modify your existing material to do so.
Building a tree house from chopping down your own trees is more time consuming but you have full control every step of the way. If you want a circular piece of wood, then you create a circular piece of wood. You still have some pre-built materials given to you like nails and screws (built-in PHP functionality) but all the custom stuff needs to be created.
Ruby on Rails is a framework. It streamlines the process building a web application or website. You can do many things with it but some may require little hacks and workarounds. If one wishes to compare Rails and PHP, it would make more sense to compare Rails with a PHP framework such as Zend or CakePHP.
What I Do Agree With
Although I think the comparison is a poor one, Derek does raise some very good points. First, I do find that sometimes it is easier to comply with what is already in place instead of trying to overhaul an entire system. I’ve worked at places where the entire system backend was built on layers and layers of poorly documented UNIX scripts. It would take an enormous amount of time to go through and figure out exactly how everything fit together in order to recreate the whole system in a more structured manner. Throughout the way, dependency problems will undoubtedly arise and everyone that has already gotten used to the old system will have to be retrained (which is no easy task).
Second, no matter how you look at it, a properly written PHP application will be faster than a Rails application. One of the drawbacks with Rails is that it is said to be hard to scale. There are solutions but for the same amount of computing power, PHP applications are typically more efficient since it leaves off a lot of extra unused fluff that is present in frameworks.
Anybody out there move back to PHP after trying Rails? I know I did for a while since I had a tight deadline on one project and couldn’t learn all the insides and outs of Rails in time.
Popularity: 5% [?]
Entries (RSS)
[...] http://www.jonlee.ca/switching-from-rails-back-to-php/ [...]
Hey Jon,
I’m moving my development back to PHP after realizing that I could count with dozens of PHP gurus for my team and hardly no Rubist.
Now I’m porting some apps I started in Rails to PHP using Akelos, which is far better than Cake or Zend for those used to Rails. I miss Ruby’s beauty but my team at least understands well what is on their hands and are really enjoying coding in PHP. Plus are on the unit testing wagon which for PHP developers is a fairly new thing.
Not sure yet why Cake, Symphony and CodeIgniter are getting that attention on the PHP world when PHP has its own Rails.
I manage people who program and am not very familiar with actual hands on activity. I however know that most programmers already on PHP are reluctant to move to anything else. Perhaps the comfort of the familiar. When I shared this info with my programmer, he almost said ” I told you so”!
My reaction is why change when you are comfortable already with PHP? I suppose that someone familiar with Rails will say the same thing.
I’ve never heard of Akelos! I’ll have to check it out, thanks dh!
The hardest part about learning something new is sticking with it and not going back to something new when challenges come up. That said, I’m not very good at sticking with things, especially with tight deadlines!
How about PHPonTrax anyone try that? I heard its pretty close to Rails in its syntax and implementation.
Joe, I have tried Rails, Cake, CodeIgniter, PHPonTrax and Akelos.
Akelos beats them all. If you come from Rails you’ll find Trax and Akelos are closer to Rails than the other two, but Akelos implements almost all the features Rails has, including a sort of ERB syntax for views.
The only thing I liked about Trax is they kept the rails_like_case_contention while Akelos UsesPearStyle, but that should be ok if you know the Java/PHP world. I’ve just realized that Trax code has not changed in the last two months which seems too bad for a framework that people is supposed to be using on a daily basis.
You can have a look at this Rails-like PHP Frameworks were I first heard about Akelos. The only bad point Akelos had at that moment was the community, but that was time ago.
[...] JonLee.ca was another blog I read a lot as we have some common interests. Jon worked hard on his site (he must have passed 100 posts a long time ago) and wrote a couple of wordpress plugins. He seems to have slacked off a bit now, I think he is making more money with Facebook applications these days! Jons blog has a mainly tech focus and he seems to go through programming languages like my wife go’s through shoes! [...]
[...] post está despertando a ira de desenvolvedores Rails mundo afora, que contra-argumentam as razões levantadas pelo autor. E levantando a bola dos fanáticos por PHP, que até caçoam [...]
I’ve switched back to PHP after a couple of years with Rails. I have to say that my time with Rails was useful, as it helped me vastly improve my familiarity with MVC. Now, I’m using the Code Igniter splinter framework KohanaPHP and love it. I’m glad to be back in the PHP world with my new MVC knowledge.