Sunday, June 17, 2012

The Popularity of Programming Languages

Over the last few months I have been renovating my programming practice.  Although I don't intend to change the language I use, I thought I would see which are the most popular languages, and try to look at them reasonably objectively.  Popularity isn't everything, but it is important.  A popular language will have more and better tools available, more books (usually) and more help available on the Internet.  It will also have more and better programming libraries available, and that can make a critical difference.

For the sort of programs I write, I need a general-purpose object-oriented language that is reasonably fast.  (More on "object-oriented" below.)

There is a lot of more or less contradictory information on the Internet about which language is most popular.  Two sites that track popularity, according to their own specific measures, are the TIOBE index (http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html) and The Transparent Language Popularity Index, so-called because all its data is exposed (http://lang-index.sourceforge.net/).   Both sites give the top eleven languages (as of June 2012) as:
    C, Java, C++, Objective-C, C#, Visual Basic, PHP,
    Python, Perl, Ruby, JavaScript
though the ordering differs.

Of the top eleven, PHP is a special-purpose language for web servers, and Javascript (which has very little to do with Java) is mainly used in web pages.  The others fall into two groups: general-purpose programming languages (C, Java, C++, Objective-C, C#, Visual Basic) and so-called scripting languages (Python, Perl, Ruby).  Scripting languages were originally designed to be easy to write very small programs in, to do things like take the output of one program, change its format, and feed it into another program.  Scripting languages have tended to evolve towards being general-purpose, but they are still meant to be more "light-weight" than languages like C++.

Among the general-purpose languages in the top group, C is the odd one out.  It is by far the the oldest (dating from 1973) and it is the only one that is not object-oriented.  Object-orientation is a style of language design that allows a very useful division of a program into chunks; ideally these correspond well to concepts in the area the program is dealing with (whether it be a computer game or a telephone exchange).  C was designed to write operating systems in; it was intended to be small, fast, portable between different makes of computer, and "close to the machine", allowing low-level operations directly.  Remarkably, C is pretty much tied for first place with the much more recent language Java (from 1995).

The object-oriented languages fall into two groups.  Java, C# and Visual Basic (at least in its .NET form) all run in so-called managed execution environments, which are intended to insulate the machine from bad behaviour on the part of the program.  The penalty is slower speed and increased memory usage, since there is a lot of extra checking, though Java doesn't do too badly as far as speed is concerned.    The other two, C++ and Objective-C, are both based directly on the C language, and like it don't have managed environments.  C++ (in particular) is for computational tasks about as fast as any language gets, and about as frugal with memory.

As far as the way objects are handled, from what I know C++ is different from the rest: C++ handles objects directly, the others by some form of indirection (essentially pointers).

So, currently there are five popular general-purpose object-oriented programming languages: Java, C++, Objective-C, C# and Visual Basic. 

If we look at vendors, C# and Visual Basic are associated with Microsoft and Objective-C is associated with Apple, though for Objective-C the compilers are open source.  Java was developed by Sun Microsystems, now taken over by Oracle; Oracle has been trying to assert patent rights over Java, though much of it was released under an open source licence.  C++ was originally developed by AT&T, but they seem to have been generous from the beginning in sharing it, and the compilers are now open source projects.

There are other general-purpose object-oriented programming languages.  The two popularity indices mentioned above differ wildly in their orderings of the languages outside the top group, though the next most popular appears to be Delphi (also known as Object Pascal), which was associated with Apple at one time and has been around since 1986.  (The underlying Pascal language dates from 1970 and thus predates C.)  Two newer languages are D, an open-source project intended to serve as an improved C++, launched in 2001, and Go, launched by Google in 2009, and also open source. 

The current revolution in hardware is the introduction of multi-core processors.  Although there have been mechanisms for dealing with so-called concurrency for a long time, they have always been difficult to use.  Go and D build in ways of handling concurrency, and maybe one of these languages will take over, though the more established languages are also changing to handle concurrency better.  The situation is certainly not stable!

No comments:

Post a Comment

Add to Google Reader or Homepage
Subscribe in Bloglines