Why has Ruby On Rails gained so much ground over PHP?

A year or two ago I remember PHP a language everyone wanted to learn and now that I'm looking around again at web languages it appears like Ruby On Rails is the hip new thing.

What does Ruby On Rails have that has caused everyone to flock over to the new technology. I thought PHP has MVC frameworks. Am I missing something?
Who is Participating?

Improve company productivity with a Business Account.Sign Up

Ray PaseurConnect With a Mentor Commented:
No, you're not missing anything.  PHP has MVC frameworks.  ROR is (much, much) more object-oriented and is, to put it bluntly, a more professional development tool.  

PHP was designed to be the easiest language to use, and as a result it has a lot (millions) of adherents who have no clue about the principles of computer science.  You can learn a little and build a web site that will "do something."  But as Alexander Pope noted, a little learning is a dangerous thing, and these novice sites will often have security holes, or will be unable to scale, or will produce incorrect output.

ROR was designed to be the best language for prototyping.  A consequence of this design is that you need to sit down and study ROR before you can start using it.  By favoring convention over configuration, it means that you have to learn and use the conventions.  To the individual who knows nothing of computer science, that is a daunting learning curve and PHP may appear to be the easier path to some kind of functionality.  

The ROR conventions are fairly well thought out; almost any site can be prototyped successfully.  But some of the early catastrophes suffered by Twitter can be laid at the feet of Ruby on Rails.  It's only a one-size-fits-all solution up to a certain scale.  Then you need bespoke programming when you want to go big.  In contrast, PHP is used for all of Digg, much of Google and Yahoo, all of Facebook, etc.

And as johanntagle correctly notes, PHP has been around for a long time (I built my first PHP web site with PHP3 in 1999), whereas ROR is a product of the new millennnium.  That alone would argue for a surge in its popularity.  An older programming language, COBOL, rose to great popularity in the latter quarter of the 20th century.  It rose to great popularity largely because it was supposed to be "self-documenting" since the variable names could be long enough to spell out human words.  Each age has its values.
johanntagleConnect With a Mentor Commented:
Obviously you will get subjective answers to such a question.  Besides enabling rapid development, I think it's because the Rails framework espouses popular methodologies like Agile, iterative and test driven development.  If you follow Rails development best practices, you already practice these methodologies.  Another would be convention over configuration - Rails has predefined conventions where to put most of your code - so you can concentrate on developing functionality vs spending time thinking how to lay out your code.  

And oh, Rails was already hip as early as 4 years ago =)
virmaiorConnect With a Mentor Commented:
Both johanntagle and Ray note some things that are true about the rise of RoR and the weaknesses of PHP.

One thing that is worth mentioning is that the RoR prototyping does tend to scale better when written correctly but again this is because RoR makes you write better code whereas PHP merely allows you to write good code (and permits you to write junk).

A further factor to consider is that RoR is trendier than PHP right now ... but don't be fooled by trends. My father is 70 and was a COBOL programmer earlier in life. He last did COBOL programming in 2009 -- and the going rate is great because there are still tons of systems out there and non-COBOL programmers don't generally know how to do it.

I don't think PHP will disappear any time soon and as Ray points out it has some big systems using it too. It's weakness is that if I hear someone writes in PHP, I don't know whether they are a script kiddie or someone with a good grasp of the theory. When I hear someone programs in RoR, I know that the code they produce is going to be easy to work on (in general).
Ray PaseurConnect With a Mentor Commented:
permits you to write junk
;-)  No kidding!

In general, for all the reasons virmaior notes, ROR programmers get paid more than PHP programmers.  That may produce an incentive for multilingual programmers to recommend ROR over PHP - it automatically moves a programmer into a more prestigious zone.

The only thing I might add to this discussion before I sign off is that ROR has not really "gained ground" on PHP in absolute terms.  It had a faster rate of adoption and growth in recent years.  This page is informative about the trends.  See especially the "Hall of Fame" part for an historical perspective.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.