note 81443 deleted from language.namespaces.definition by philip
| From: | philip@php.net | Date: | Fri, 28 Nov 2008 18:52:09 +0000 |
| Subject: | note 81443 deleted from language.namespaces.definition by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-147105@lists.php.net to get a copy of this message | ||
Note Submitter: FB
----
RS wrote on 27-Feb-2008 07:31:
"I don't see how this implementation of namespaces gives you anything you didn't
already have.
Let's say someone is writing a set of classes to handle gizmos... most developers would write
something like:
<?php
class GizmoBird() {
}
class GizmoPlane() {
}
?>
Now with namespaces, this would look like:
<?php
namespace Gizmo;
class Bird() {
}
class Plane() {
}
?>
But this doesn't really help you isolate your classes any better. someone else could still
write another set of classes with the same namespace, and Gizmo::Bird would clash with another
developer's Gizmo::Bird, in the exact same way that GizmoBird would clash with another
developer's GizmoBird.
So effectively, all you've done is add a couple of colons to the classnames...
I honestly hope developers in general don't start using this..."
Let's suppose that your company would do this in java, you create the package com.rs.gizmo and
put your classes Bird and Plane into it. Then another developer could stuck other classes into your
package.... you see what I mean? it will always be the same thing in php, java c#, c++, etc....
Putting classes in the wrong namespace is not language's fault...