mark.watero.us

Wordpress stuff, a statistics plugin, and jello

PHP has no hidden features

leave a comment

I came across the following post this morning, and decided to write a post about it (bored much?):

Hidden features of PHP? Stack Overflow

My first impression of this question is that it’s nothing more than another troll, given the authors criticism of PHP being shallow at best. I’ll bite.

“…bothers me that all variables at a class scope have to be referred to by appending ‘$this->’…”

Except for the fact that you might have to type a few extra characters to reference your objects properties and methods, I fail to understand how this is a negative feature of PHPs OOP constructs. This ($this) provides you with an easy distinction between method level variables and object level properties.

class variable_scope {
    public $variable; // This property is accessible inside the object via $this->variable or outside the object with $object->variable
    private $var; // Visible only from inside the class itself, but acts like a global as you can it from any method

	public function __construct ()
    {
        $variable = 'lipsum'; // This variable is only visible within the current methods scope and is different from $this->variable
    }
}

Maybe somebody could help clarify for me how this is handled better in C#, as I can honestly say I don’t know.

…annoys me that none of the IDEs that I’ve tried have very good intellisense…

You shouldn’t be relying on your IDE to autocomplete and syntax highlight for you in the first place. If this is the criteria you’re using to choose a programming language, you probably should consider staying with Microsoft products (such as C#) as they permit ‘visual’ creation of applications, allowing you to do a lot of the work without having the slightest inclination of what is actually occurring behind the scenes.

…drives me crazy that dynamic typing keeps me from specifying implicitly which parameter type a method expects…

Type Hinting. ‘Nuff said.

…I find myself picking up a php project doing some coding for a friend’s start-up and I feel completely constrained…

Looks like I was right, this is a troll. After reading the above statement I just happened to look at the posters profile page where he states, “My other programming interests are PHP, F# and Python which I am all bad at.”. Maybe that could explain why he’s feeling a little constrained?

You can’t judge a language based on your lack of knowledge or experience with it. Everybody has to make a decision at some point in their career where they decide what they’d like to specialize in, and what feels right for them. If this is C#, or .NET, or PHP, it doesn’t matter, but be comfortable in your decision without feeling the need to try and breathe down the necks of people who make alternate decisions. Being tolerant of everybody’s right to make their own choice is a simple task.

To put a spin on an old saying, 20 million users can’t be wrong.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • LinkedIn
  • NewsVine
  • Reddit
  • StumbleUpon
  • Technorati
  • Twitter

Written by mark

July 20th, 2009 at 2:49 am

Posted in General

Tagged with ,

Leave a Reply