Moritz Haarmann’s Blog

Icon

for the sake of completeness!

Why PHP should be banned.

Neither is Basic! Really, normally I’m trying to be objective, but I just can’t when it comes to PHP. I’ve done a lot of stuff in PHP over the years ( yes, including a CMS, Portal, Guestbook and Gallery ) but as far as I can tell this language meets every requirement to be disqualified as something to consider when it comes to serious, professional software development.

There is certainly good software ( or software that pretends to be good ) written in PHP. But it’s not the majority. PHP just encourages programmers to do everything insecure, non-reusable and not really portable.

Just think of the word PHP/MySQL, which is nothing but a pain in the ass. I’ve been running Postgres for years, and every now and then a small PHP script comes my way requiring MySQL. Whhuuzza. No Database Abstraction. And now that there is one, all popular software still uses these funny mysql_do_whatever() methods.

Function naming is certainly another thing that terribly went wrong at some stage of the development. Has someone ever scanned the PHP sources for the functionNameObfuscator.c? I guess there is none, as no program could ever obfuscate stuff that badly. Now, in the upcoming PHP release there will be finally support for Namespaces, though I’m not really convinced that any of the built-in stuff will be used there prior to 2010.

PHP is perfect to learn some concepts. Like OOP, because there is no need to compile stuff, no need to worry too much about data types and stuff, but once you’re about to do a real project, keep in mind that type checking, namespaces etc. are stuff that could potentially matter at some point of the development. 

What I find most confusing is that simple statements just don’t work. Why? I don’t know, they just don’t. Example? There you go

// assuming the function foobar() returns some array.
// this won't work.
echo foobar()[0];

Cool, hu? Not really. And as far as anything WebProgramming is concerned, I just learned my lessons and use something like Merb, Rails or even Java EE. G’day.

Related posts:

  1. Pass-by-reference workaround in Java As anybody knows, java passes variables by value. and i...
  2. A real open-source, usable, photoshop replacement? Good morning, folks! Now I’m back in germany, still busy...
  3. Antiusability at its best: Language Documentation Whether you’re an active developer busy doing some Java, Ruby,...
  4. The top 25 programming errors: Watch and avoid Security is always a big issue, whether you are writing...
  5. The need for web-development certification Good day. I need to distract myself from trying to...

Category: tech

Tagged: , , , , ,

5 Responses

  1. pfleidi says:

    PHP is perfect to learn some concepts. Like OOP, because there is no need to compile stuff, no need to worry too much about data types and stuff

    I would say there are other interpreted languages like ruby or python that would do a better job as a language to learn concepts. ;)

  2. momo says:

    yes, but they are not as widespread, so i guess that’s why php is still the choice for many people outthere… unfortunately ..

  3. max says:

    If you want to learn the very basics of programming (including concepts of data abstraction) I warmly recommend getting a copy of “Structure and Interpretation of Computer Programs” from your local library.

    And for web programming on shared hosts you can always pick the lesser of the two evils, which is Perl.

  4. enctype says:

    You can’t compare a PHP with Rails (language vs. framework), doesn’t make sense.
    Depending on the developer you can write good/bad/reusable/non-reusable code with any language.

  5. momo says:

    hey, i didn’t compare php with rails, and i’m not going to. here. but still, you are right when it comes to developers being responsible for code quality, yet a programming language can encourage programmers to do something right or not, and php is certainly not one of the languages that are overly strict about good conventions being enforced, i guess you agree with me there. i had my fun with it, but i’m just ( for the reasons above ) done with it :)

Leave a Reply