The age-old debate between PHP versus ASP.NET is not really what I am trying to get into here. I am also not trying to talk about “PHP being faster” or “PHP being free” and “85% of the webservers run Linux and so Apache and PHP come built in anyway” concepts.
I am seeing this from a programmer’s point of view. I have worked with many languages right from 8086 assembly, c, C++, c# to asp, ASP.NET, PHP etc. I think I have gained enough insight to see why a language becomes popular – its all about programmer psychology.
The reason why PHP is so popular is actually the reason why sometimes its looked down upon:
Its a collection of separate functions and modules
with no common thread linking them.
That is precisely why PHP is so popular.
Let me explain. PHP is mostly used for web applications though it can be used for console applications as well, but I still think 99% of the world uses PHP for creating websites. It is not a framework like ASP.NET per se and that is why it lets you be sloppy and start off with a blank page and banging out code. (Try doing that in ASP.NET) .It has functions for nearly every damn thing you would ever need to create applications right from string functions to parsing text to file handling to regular expressions or mathematical functions.
What it says is “hey, I am not forcing you to be disciplined in your code – that is your responsibility but I do have everything you need. Feel free to use it as you need“.
That is what makes it so appealing. As a programmer I can follow any structure or architecture I want. PHP gives me the building blocks to create my own structure. It does not force me into a particular model.
It is also very forgiving.It wont crash the website if it encounters an error unless its a very serious resource linked error.
It lets you play around with code without too much restrictions. It allows quick and dirty coding.
This is precisely what programmers need – a language which lets you run amok while providing you a safety net and also having all the building blocks in place. Something like C minus the risks .
I have not really worked in Ruby or Python but most probably they also provide something similar. Any language which gets popular will certainly have the above features.
At the other extreme is COBOL which no programmer ever felt passionate about. It robs you of all freedom. Writing code in COBOL is like filling up a tax form – you dont have any choice. You just have to follow a strict outline .
I welcome comments on other languages