2014-05-30

There are lots programming languages out there and each works to do specific and unique tasks. Each language has a unique set of keywords and special syntaxes for organizing program commands.

In today’s article, we’re going to take a look at the three popular languages: PHP vs Ruby vs Python. We will check how they work, how they differ from each other, who uses them and how popular each language is.

At the end of this article, you will have the idea which one to learn and which the best option for each specific task is.



PHP: Most Popular Scripting Language for the Web

PHP (Hypertext PreProcessor) is a server scripting language designed by Rasmus Leodorf, a powerful tool to create dynamic and interactive websites. It is fast, flexible, widely-used scripting language for everything from a simple blog to the most popular and dynamic websites in the world.



Advantages of PHP

Free software released under the PHP license

Easy to learn (Short learning curve)

Large community of users and developers

Provides extensive database support

Offers great number of available extensions and source codes

Allows execution of code in restricted environments

Offers native session management and extension API

A great alternative for competitors like Microsoft’s ASP (Active Server Pages)

Can be deployed on most web servers

Works on almost every operating system and platform

Disadvantages of PHP

Not suitable for making desktop applications

Error handling is traditionally poor

Global configuration parameters can change language semantics, complicating deployment and portability

Objects are CallByValue by default, which is the opposite of most languages and catches lots of programmers off-guard

Generally considered to be less secured than the other programming languages

Who Uses PHP?

Zend

Yahoo

Facebook

Google

NASA

W3C

Popularity

According to Wikipedia, as of January 2013, PHP was installed on more than 240 million websites (39% of those sampled) and 2.1 million web servers.

Syntax

A PHP script starts with < ?php and ends with ?> The default file extension for PHP files is “.php”. A PHP file usually contains HTML tags, and some PHP scripting code.

Ruby: Interpreted, Pure Object-Oriented Programming Language

Ruby (programming language) runs with Ruby on Rails or simply rails, an open source, full-stack web application framework. It is a dynamic, imperative object-oriented programming language developed by Yukihiro Matsumoto in Japan. It was influenced by Perl, Eiffel and Smalltalk. It a has dynamic type system and automatic memory management.



Advantages of Ruby

Open-sourced

Works on multiple platforms

Can be embedded into Hypertext Markup Language (HTML)

A Very High-Level Language (VHLL)

Offers encapsulation of data methods within objects

Pure OOP (Object-Oriented Programming)

Super advanced string and text manipulation techniques

Can easily be connected to DB2, MySQL, Oracle, and Sybase

Scalable and big programs written in Ruby are easily maintainable

Has a clean and easy syntax that allows the new developer to learn Ruby very quickly and easily

Ability to write multi-threaded applications with a simple API

Offers advanced array class

Able to write external libraries in Ruby or C

Allows “reserved word” to be used as an identifier as long as the parser doesn’t perceive an ambiguity

Better security features

It has a debugger

It has flexible syntax

Powerful string handling

Disadvantages of Ruby

Learning it can be difficult

Lacks informational resources

Slower processing time (CPU time) compared to other programming languages

Development and updates are slower

Who uses Ruby?

Google Sketchup

37signals

GitHub

Shopify

Indiegogo

Basecamp

Popularity

According to the Ruby website, it is ranked among the top 10 on most popular programming languages worldwide (such as the TIOBE index). Much of the growth is attributed to the popularity of software written in Ruby, particularly the Ruby on Rails web framework.

Syntax

All Ruby files will have extension “.rb.” Using the Ruby interpreter available in /usr/bin directory, you can run Ruby codes.

Python: General Purpose Programming Language

Python is a widely-used high level (but it also used in a wide range of non-scripting language) design for programmers to express concepts with fewer lines of code. It was conceived in the late 1980s and was implemented by Guido van Rossum.

Python code resembles the pseudo-code just like all the scripting languages. The elegant design and syntax rules of this programming language make it quite readable even among the multi-programmer development teams. It supports multiple ways of building the structure and elements of computer programs, including object-oriented and functional programming.

Advantages of Python

Easy and quick to learn

Runs in multiple systems and platforms

Readable and organized syntax

Offers rapid prototyping and dynamic semantics capabilities

Great community support

Easily construct applications by testing and importing crucial functions

Reusability through carefully implementing packages and modules

Object Oriented Programming-driven

Disadvantages of Python

It doesn’t really do multi-processor/multi-core work very well

Smaller pool of Python developers compared to other languages, such as Java

Absence of a commercial support point, even for an Open Source project (though this situation is changing)

Database access layer limitations

Reputed to be slower than languages such as Java

Who uses Python?

Yahoo Map

Zope Corporation

Linux Weekly News

Shopzilla

Ultraseek

Popularity

According to Wikipedia, since 2008, Python has consistently ranked in the top eight most popular programming languages as measured by the TIOBE Programming Community Index. It is the third most popular language whose grammatical syntax is not predominantly based on C, e.g. C++, C#, Objective-C, Java.

Syntax

Invoking the interpreter without passing a script file as a parameter brings up the following prompt:

Typing the some text to the right of the Python prompt and press the Enter key will output the text:

Job Demand

Based on Jobs Tractor which analyzed more than 45,000 developer jobs advertised on Twitter during the past 12 months, the results are the following:

PHP – 8,238

Ruby - 2,937

Python – 1,587

Although PHP still has the higher statistics on this site, remember not to use statistics as the basis for learning or using a programming language.

So Which Is the Best Programming Language to Use and Learn?

The answer you’ll have from the most of the programmers is: “You can do everything with all of them”. All of them are good options. There is no real good or bad answer. It always depends on what you want to accomplish.

If you take a step to learn a programming language, chances are, you will use built-in frameworks to use for your projects. Basically, a web framework makes it easier for you to develop your application. Most sites have a common set of functionality (like handling sessions and data validation) and a framework is something that prevents you from re-writing this each time you create a website.

PHP has several number of developed CMS frameworks available if you already dived in learning it. The most popular PHP CMS are WordPress, Joomla, and Drupal with most of them having loads of plugins. You can write new ones easily with a few days of patience and going through the tutorials.

There are others that are quite good too, but using the popular ones increases your probability of finding support quickly or finding that plugin you might need. For Python, there is the Django and CherryPy web framework, which give you quite a good tool kit.

If you go for Ruby, I think you’ll be a bit more limited (since that the language is newer) but the its basic framework is Rails. You also need to consider which language offers the best support so that you can find answers quickly in case you encounter problems with your codes.

PHP is the best language for creating HTML pages

Python is a general purpose programming language. It can be used to build almost anything from web apps, crawlers, daemons and desktop GUI applications.

Ruby is best at creating web application of data entities quickly so that you can focus on the special functionality rather than on the query operations: insert, update and delete.

And that’s it. Hope you had an overview about which programming language to learn. I believe you also have your own views. We want to hear from you. Leave a comment about what you think.

Show more