PHP vs Ruby and the Python Phenom

May 16th, 2013 Leave a comment
Like the article?
PHP vs Ruby and the Python Phenom

Both Ruby and PHP have been around since 1995, but the “newcomer” Python is actually older, first appearing in 1991. Since their introduction, the three development languages have taken very different journeys to the present, now finally coming to the scene as co-equals. Much of the argument over language is centered on PHP vs. Ruby and how these two stack up against one another. Each has advantages and disadvantages, but now with the re-emergence of Python as a popular choice (thanks mainly to Google), the head-to-head battle has become a trifecta.

History and Purposes

In any good discussion of programming language choices, the history and purpose of the languages must be considered. Of the three, the one which gained the most success from the beginning was PHP. Upon its introduction in 1995, it quickly became the go-to source for embedded scripting to provide dynamic functionality on static pages. During that part of the history of the Web, pages were largely delivered in pure HTML with most of the work being done by the browser at client-side rather than on the server’s end. PHP was therefore not created as an object-oriented language, but as a script for adding interesting functionality to websites. Thus, most of the current OOP additions were after-the-fact, which explains the often clunky way that PHP seems to handle some things.

Unlike PHP, Ruby was made from the get-go to be object-oriented and largely server-side. It was very similar to Perl, considered the predecessor of both PHP and Ruby, but is much more readable and modular. Ruby, however, suffered from adoption problems due to its lack of a useful Web application framework. It also had a large stumbling block due to a language barrier – the original Ruby was written by Japanese coders and the first English language book on the language was not published until five years later. By then, PHP had firmly seated itself in much of the English language world of developers. Ruby did not really take off until Ruby on Rails was introduced in 2005 and subsequently adopted by Apple by being included in shipments of their OSX operating system. Since then, other WAF options for Ruby have been introduced, including Sinatra.

Python, like Ruby, took a while to catch on. It differentiates itself from PHP and Ruby by being focused on code readability and simplicity. Because it appears to be so simple and over-focused on form rather than function, it was often chided as being a child’s language and one only for use by beginning programmers. Until it’s major re-think that resulted in the release of Python 2.0 in 2000, it was largely ignored by developers. That release, coupled with the emergence of geographically diverse collaboration made Python much more competitive as its easy-to-read format meant that diverse developers on a single project could easily collaborate without requiring a lot of in-line or explanatory comments in the code. Its adoption by Google for this reason propelled it into the spotlight to begin seriously competing with the more dominant PHP and Ruby.

Currently, PHP is fast becoming a “legacy language” in favor of the (perceived as) newer Ruby and Python. Of the three, however, PHP still enjoys the largest amount of implementation around the Web, but new startups and enterprises are turning to the other two options more often than to PHP.

Uptake Rates for P-R-P

Despite the apparent dismal outlook for PHP, it is still dominant and the new additions of packages to make libraries that are independent of the framework, which will put PHP back on par with Ruby, its greatest rival, which has had these (called gems) almost since the beginning. So the playing field is still very much active in regards to all three participants being in the game.

PHP has, by far, the largest number of deployments online, according to both the TIOBE Index and the IEEE Spectrum. PHP has about twice the number of developers and the number of active apps online than does Ruby. Python has nearly equaled Ruby in deployments, but is ahead the in number of active developers listed on LinkedIn. IEEE Spectrum also measures online discussion rates for various programming languages and ranks Python as the most-discussed while PHP and Ruby are roughly 2/3 and 1/3 of that respectively. This is a good sign that Python is growing fast and will continue to do so, despite the lower number of active users.

PHP’s legacy shows in its current “need” metric, though. A comparison of job postings on Craigslist, Monster, and Freelancer shows that PHP dominates in a big way. The real competition here is between Ruby and Python, which average out to be about equal when all three job sites are considered.

These numbers are interesting and show that each language has its own dynamics in the marketplace. For most developers and project managers, the choice of language comes down to need – what is needed and what fits that need best.

Python, for example, is relatively easy to implement in collective efforts whereas Ruby on Rails and Ruby on Sinatra are often the choice of those looking for powerful options – it was the choice, for example, of Twitter until they moved to a Java Virtual Machine framework a couple of years ago. PHP still has many adherents and is often the choice when legacy machines or lower-cost development is required – developers in this language are easier to come by and thus cheaper to hire versus the other two options right now. Many of the Web’s most-used sites, including Wikipedia and Facebook, use PHP extensively.

Because Python is so (relatively) easy to learn, the number of developers using it is growing rapidly. Ruby, meanwhile, is the most difficult of the three and so has a slower adoption rate by those learning new tools.

Help us spread the word!
  • Twitter
  • Facebook
  • LinkedIn
  • Pinterest
  • Delicious
  • DZone
  • Reddit
  • Sphinn
  • StumbleUpon
  • Google Plus
  • RSS
  • Email
  • Print
Don't miss another post! Receive updates via email!