I have gotten pretty good at staying out of language flame wars recently. Usually, when some wide eyed neophyte wipes a trickle of Kool-Aid from their chin and says “Ruby is sooooo much better than PHP”, I just say “uhuh”. I can’t be bothered opening a can of Terry Chay on them and I don’t really see the point. I can’t even usually be bothered saying “uhuh, that is why Twitter is the only A-list Web2.0 site built with Ruby and it is down all the time.”
Every now and again though, I just can’t help taking the bait.
You used PHP to write WHAT?! by Kenneth Hess on CIO.com grates. PHP programmers in general are pragmatic. It is not generally a language chosen by purists and zealots who latch onto one tool and claim it to be perfect in every way, and appropriate for every task. There are plenty of people with deep PHP knowledge who could have written an insightful article fitting into the CIO series’ theme that no one language is right for all applications.
Pap annoys me more when it appears in something claiming to be mainstream media than when it appears in some loser’s blog. Traditional media, while possibly doomed, does employ editors and generally attempts to check facts.
Well, sometimes they check facts. Ignoring the subjective parts that are merely the authors opinion, this article has so many simple factual inaccuracies that it is laughable. I assume the author does not have a great deal of experience with PHP.
Given he claims you can port an application from one database to another with minimal effort by running find and replace to swap mysql_query() with mssql_query() it seems likely that he has never written a non-trivial application in any language. So his major claim that PHP does not scale is presumably based on conversations he had with the fairies that live at the bottom of his garden.
Maybe it is just that Java fanboys push my buttons more than Ruby fanboys. Maybe it is just that damning with faint praise is more annoying than overt attacks. Barack Obama is “articulate“. Australia is “lovely” and reminds Bill Bryson of Iowa in 1958. PHP is good for “Creating an intranet site”. Come on!
Actually, it is might not not even be the factual inaccuracies and unsupported assertions that irritated me most. When I hear “enterprise” used as an adjective and not a punchline I involuntarily clench and it is there five times on one page.
Postscript: A couple of days later, Terry Chay could not resist opening a can of Terry Chay on them.
[...] Welling, security analyst for OmniTI consulting and bestselling PHP author, puts in his perspective. I wrote this article before Luke, but notice the similarity from realizing the article is [...]
hi
i had some knowledge with php and asp, but im not an advanced one. recently i decide to learn php in more depth. because i like open source and i see a lot of fans trying to make it better than before.
and im reading a book for it. i mean your book in 4edition
something that bother my mind is function names.
i want to know why functions (not all of them though) have no meaningful names in them? why they select a chop() name for a function?
another thing is naming abbreviations
for example if i want to work with files, i have: fread(), readfile(), fpassthru(), file() functions. and as you see none of them tells you what they do if you are not familiar with them.
also for naming, some of them use “file” (like: readfile, file) and some of them use “f” as abbreviations (like: fread(), fpassthru()) .
also for reading from file i have: fgets(), fgetss(), fgetcsv(). again, name tells you nothing. for example if you see fgetss() for the first time, you cant say what is the difference between fgets() or fgetss().
another problem i see in functions is name convention. for example we have file_exist() and filesize(). why in some function there is an underline between names and in some of them there isn’t?
if i know some language like c or delphi, i expect when i use filesize(), there is a function name fileexist() or vice versa.
also i noticed that php still haven’t got unicode support for function names and some others but asp had it a long time ago.
i know unicode support probably needs huge code to be implemented, so its not a big deal in my mind if php haven’t got it since.
but names of function is a simple thing to fix and it should be straightforward for those who are going to learn php.
as far as i know, asp have a better naming and almost all of them gives you some idea about what they do.
i was a fan of php and when we debate with my friend, i was in php side and against asp.
the next thing that i couldnt figure out is new feature, i looked in changelog of php 5.3, and i see its now support for closures ans true anonymous functions, i know it has its use, but lets face it, doesnt something like this make our code much less readable?
i see an example about it in wikipedia:
function getAdder($x)
{
return function ($y) use ($x) {
return $x + $y;
};
}
$adder = getAdder(8);
echo $adder(2); // prints “10″
and about C, yes it is heavily on C syntax, but php should not have filesize because C have no filesize at all as far as i know, so if we want to be like C, we should have file_size(). because C use underline in such a functions. example is file_exist()
all i read in programing source in computer science, they say one parameter for a good language is a good naming convention.
and for a language like php, i think its good to have a perfect naming convetion, i mean come on, its not hard to implement a good name for a function.
just like globals removed. or magic quotes that going to be removed.
if you say we should support backward compatibility, i say at least make these bad names an old feature, so they will be fixed in next versions.
another thing is parameter order, for example when you work with strings we have to function,
explode:
array explode ( string $delimiter , string $string [, int $limit ] )
and strtok:
string strtok ( string $str , string $delimiter )
so which one? delimetter before string or after.
i know these are not such a big thing, but i think they can fix it very easily, i mean come on its just a function name.
these things that i see are bothering me, can someone please correct me if im wrong?
i hope i could make my mean clear.