Posted on | March 3, 2008 | No Comments
I’ve been asked on many occasions to explain my aversion to higher level languages, such as PHP. I have absolutely nothing against PHP, in fact, I use it to power most of echoreply. What I can’t stop bitching about is how people use higher level languages when they have no real knowledge of what their code does to a user’s computer.
To make this completely clear, I’m going to dive into the land of analogies. Writing stuff in PHP is like writing a movie script. Writing stuff in lower level languages (like C) is like writing a book. The difference being, when you write a book .. you aren’t counting on famous and talented actors to just ‘make your ideas happen’, its up to you to program the reader’s brain. Have you ever said that a movie was not quite as good as the book it was based on?
If I use a char * or char ** type in PHP, I don’t need to know what char * or char ** means.. by extension, who cares if the strings or arrays are freed? PHP just ‘does it’ right? Not always, but usually. The following makes this sort of clear. In C:
char *tmp = (char *)malloc(MAX_VALUE);
memset(tmp, 0, sizeof(tmp));
In PHP, you’d just say:
$tmp = $_HTTP_POST['tmp'];
Huh? malloc? memset? what do they do? Many very good PHP programmers ask me this kind of stuff. This means, they have no idea what PHP is actually doing to a computer as a result of their code. Many of them have never looked at the underlying low level code that makes PHP. A screenwriter has no idea how Dustan Hoffman is going to play the part of a character. Your idea depends on what version of Dustan Hoffman you use and what planet he’s currently living on (last reported was Earth). A PHP programmer has no idea how any given machine is going to execute code.
Just because you do more with less lines of code doesn’t mean its more efficient.
My concerns that this current SAAS (software as a service) trend is breeding an army of brain-dead programmers do not come from me being pedantic, they come from me being realistic.
Moreover, how many are going to cut their true potential short to go chase money that some start up company has to offer? Learning PHP takes very little time (by way of comparison to low level languages) and pays you quite well.
Finally, how many brilliant developers is the Free/Open Source ecosystem losing to this very lucrative promise?