Read the latest web development and design tips at Fred Wu's new blog! :-)
Poke me on GitHub

Posts Tagged ‘naming conventions’

PHP Namespace – $this->sux

Federico makes an interesting point about the PHP Namespaces Controversy on his PHP::Impact blog. I never thought about the mess that is PHP until I saw his comparison table:

Java:
Attribute/Method access: foo.bar
Static method access:    Foo.bar
Package access:          foo.bar.baz

C#:
Attribute/Method access: foo.bar
Static method access:    Foo.bar
Namespace access:        foo.bar.baz

Python:
Attribute/Method access: foo.bar
Static method access:    Foo.bar
Module access:           foo.bar.baz

PHP:
Attribute/Method access: $foo->bar
Static method access:    Foo::bar
Namespace access:        C:\foo\bar\baz

I guess I can’t complain though as the syntax of PHP is still a lot closer to more “traditional” languages than something like Ruby (not talking about the namespace, just the language in general)… :)

Related posts