|Language Wars - PHP, Python, Ruby|
|Written by Mike James|
|Saturday, 11 February 2012|
Want to start an argument? Simply say any one of the three languages, Python, Ruby, PHP, is the best. Programmers tend to be very fixed in their language preferences and very ready to recommend their favorite to you.
I wouldn't really say it was war, but these three languages present a real dilemma when you are trying to choose. They are all what you might call "modern languages", they share a lot in common, but they also have distinct characters and motivations.
The main similarity from a technical point of view is that they are all dynamic object oriented languages. They are mostly encountered in the wild as interpreted languages, although you may find the occasional compiler if you look hard enough. They are also open source, free to use, and not really backed by a big company - with the possible exception of PHP and Zend.
So why invent a new language?
The answer is basically because people found that the existing languages didn't do what they want. Over time other people agreed and joined in the effort to create and use something new. This is one way language creation works; the other is that big companies decide that their best interests are served by introducing a new language - Sun and Java, Microsoft and C#, Google and Dart and Go.
So why three languages? Are they so very different?
The truth is, and here I am inciting wrath from each of the three camps. there isn't that much difference.
They are all dynamic, object-oriented languages - even if PHP had to evolve to become so. They all do things in a very similar way, with perhaps one or two differences that seem important to their aficionados.
PHP is possibly the outlier in that it really isn't an elegant language. It has been retro fitted with lots of things to attempt to make it elegant, but... it still isn't. However, it is a very practical language and you can use to to create server-side generated web pages very easily.
Both Python and Ruby were better designed from the outset than PHP, but they don't occupy the position of the essential server side language. They would both like to, with Ruby and Ruby on Rails putting up the biggest effort to be so.
Python's main claim to fame is the way that everything is an object and program layout influences meaning. Yes, it matters how you indent a program as this determines what constitutes a block of code.
Ruby is similar to Python but with some interesting extras such as code blocks and facilities that allow runtime code modification. This makes it fairly easy to implement language extensions and "meta" programming in general.
More information to fuel the debate is included in Udemy's infographic:
Click to enlarge
This chart is originally from http://www.udemy.com/blog/modern-language-wars/ (click link for hi-res version of the chart) where you can find online courses on programming languages.
So which of the three do you choose?
In many cases the choice is outside of your control. For example, if you want to work with a LAMP-based website then PHP is really your only easy choice. If you want to create a Rails website then Ruby it is. Python is much more of a free choice, in that there are no major infrastructure that forces you into its grasp. You will, however, find lots of areas where Python is commonplace - natural language processing, some areas of AI and so on. Apart from this you are really left with the flavour you like best.
or email your comment to: email@example.com
|Last Updated ( Wednesday, 05 August 2020 )|