The best way to think of a programming language is as a tool, one of many in your toolbox. Just as you shouldn’t use a hammer to tighten screws or a screwdriver to drive in nails (I have done both — not too successfully!), you need to use languages that are appropriate to the tasks you face. For example, you wouldn’t write an operating system in PHP, which is really meant to generate Web pages.
When the Web first appeared, no proper server languages existed. People wrote Common Gateway Interface (CGI) programs in a variety of languages, including as compiled programs in C and C++. These compiled applications created quite a lot of overhead, since they had to begin a new process for each request. Other, more appropriate technologies — such as Java EE, ISAPI, NSAPI and Apache Modules — soon appeared and became popular choices. C was also not ideal because of security. ANSI C is like a chainsaw in a novice’s hands and websites have been hacked due to exploits.
Developing for the Desktop
Windows didn’t appear until the early 90s – well, not a usable version anyway. C/C++ were the main tools then, but it was hard going until visual programming languages like Visual Basic and Delphi came along. Java emerged late in the decade but lacked a decent GUI, so it became the main server development language.
Since 2000, C# has grown to become a major GUI language on Windows and, to a lesser extent, on Linux. But it doesn’t work as well cross-platform as Java. Many companies use Java on the server side (on a Linux box) with C# as the front end on Windows.
PHP comes out way ahead here. It’s not a perfect language by any means, but if you want to put together a database-driven website then you’ll use either PHP or, increasingly these days, one of the hundreds of open source packages built on top of it.
By any measure, PHP is a major success for open source. Of course, if you’re in the Microsoft camp, you can create websites using C# with ASP.NET and ASP.NET MVC technologies. PHP is ahead in numbers probably because every Linux hosting setup includes it for free. Until recently, Microsoft hosting has always cost more.
C# and Java fight it out as top tools here, along with Android and iOS. Apple’s iOS is based on Objective-C, which was invented over 30 years ago and is C with classes and message passing between objects. With over 1 million apps in Apple’s app store, most of which are programmed in Objective-C, it’s a highly popular language. Note, though, that Android also passed the million app mark, and most of the titles are written in Java.
In the Browser