Home > PHP > PHP, the things I hate in language I love

PHP, the things I hate in language I love

August 31st, 2008

Strange function names. Strange, silly, stupid and so on. Call them whatever and however you want. As to my knowledge, PHP originally had function names combining multiple words as one like “dosomeactionfunction()”. With time, community realized this is not so good practice so they decided using underscored function names like “do_some_action_function()”. Personally I hate underscored names both for functions and for variables. I’m a fan of camel caps convention popular in object oriented programming. With camel caps your function names got written like “doSomeActionFunction()”. If nothing else it’s shorter.

Absence of namespaces. PHP 4 already introduced some object oriented concepts, but PHP 5 was the big brother, the one promising the object oriented support fully. Again, personally, I think it’s funny and impractical seeing object oriented programming language without some sort of a good namespace support. I hate includes, requires, and auto includes and so on. You get the picture.

String handling. If you ask me, PHP 5 should have been fully unicode armed and ready for the web. For a language designed specifically for the web this is hilarious. Web is about being world wide, meaning support for multiple language characters, encodings and so on. Sure there are number of community classes out there you can use for free, but that’s not my point.

Collection object. How cool is this? Not cool at all, because PHP 5 has no collection class built in. I’ve done some programming in C#, and let me tell you, it’s one of the most beautiful languages out there. Don’t get me wrong, cause I’m not a big fan of Microsoft. Anyhow, C# (.NET) is all about collections. I realize collection object utilizes arrays to create functions (methods), I also realize it takes only a few hours to develop your own collection object but still I’d like to see built in class for collection object in PHP.

What’s the point of member visibility? Let me elaborate this. Imagine, you create a class “PhoneBook” containing private variable “private $someVar = “Some var content”", then create a class “PhoneBookUser” which extends the class “PhoneBook”. Now imagine you make the instance of a class “PhoneBookUser”. If you where to do something like

$instance = new PhoneBookUser();
$instance->someVar = “another content”;

Now if you do var_dump($instance) you would see you now have two variables named “$someVar”, one of them is private (containing “Some var content”) and the other one is public (containing “another content”).

Public by default. I really, really hate this one. If member visibility is not specified then it’s set to be public. This might be good solution for variables but in my opinion it’s not so good solution for functions (methods). I’d like my method be private by default. That way, some basic security measurements would be built into the language itself.

Static or dynamic? Again, what’s the point? Imagine you create a class named “SomeClassName” with two methods, one static “static function methodOne()”, other dynamic “function methodTwo()” (just omit the word static from it’s declaration). When you create the instance of that class you are able to call both methods on that instance object. However, you’re also able to call both methods like “SomeClassName::methodOne();” and “SomeClassName::methodTwo();”. PHP wont throw any errors if you try to call the dynamic “function methodTwo()” method on non instance. So my question is, what’s the point?

I’ll stop here. I love PHP for few reasons. One of them is being free and open source. It’s widely community supported by now. It runs on many different platforms, from Windows, Linux, Unix, MacOS and so on. What I’d like to see in PHP6 is the full OOP support.

Many experience programmers ignore the value of good IDE studio. PHP for now has no IDE studio that can match Visual Studio from Microsoft. I haven’s yet seen the flawless debugger for PHP built inside some IDE like the one developers have in Visual Studio for C#. I haven’t yet seen flawless code completion like the one developers have in Visual Studio.

Most of developers talk how PHP is easy language to learn. I say it’s not. There is nothing easy in memorizing tons of function names and their parameters, and belive me without the help of good code completion feature this is something you’ll have to do. Memorizing, and searching trough documentation can be very time consuming. Not to mention the learning curve.

At the end I’ll just say how I strongly think and hope so that PHP6 will become fully OOP language and someday soon will see open source IDE matching it’s greatness. When it comes to IDE, so far I vote for NetBeans IDE with PHP support.

Interesting? Share it!
  • Digg
  • del.icio.us
  • Google
  • Technorati
  • Facebook
  • TwitThis
  • description

Related articles

PHP

  1. Jeffry Degrande
    September 1st, 2008 at 11:03 | #1

    My biggest concern with PHP is the fact it’s not strong typed. All the side-effects of that is what makes PHP hard to learn (!== to differentiate between FALSE and 0 for example). Madness.

    2 remarks though. PHP does provide interfaces to build collections (see: http://www.php.net/manual/en/language.oop5.iterations.php) and PHP does implement namespaces (pretty limited, but still, namespaces, see: http://www.php.net/manual/en/language.namespaces.php)

  2. September 1st, 2008 at 17:13 | #2

    Hi Jeffry!

    I really appreciate the comment. Nice to see someone reads my site :)

    You’re right about both remarks.

    My mistake with not elaborating with enough details.

    About the collections, as I said, it’s easy to build you’re own class, I just like to see it there by the default, to get that general feeling of PHP collections.

    As for namespaces, they came to PHP from version 5.3., if I undestand it right. Problem, most of the current web hostings do not support PHP version 5.3 for now. Even developers tools like WAMP come with PHP version 5.2.6 as of thime of this writting.

    I’d like to see PHP scream I’m OOP language and you should programm in me like I’m OOP language.

    And about the “strong typed” issue; I’m totally with you on this one.

  1. No trackbacks yet.