note 81443 added to language.namespaces.definition
| From: | FB at osu1 dot php dot net | Date: | Thu, 28 Feb 2008 12:05:11 +0000 |
| Subject: | note 81443 added to language.namespaces.definition | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-136559@lists.php.net to get a copy of this message | ||
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...
----
Server IP: 200.185.126.110
Probable Submitter: 200.215.31.35
----
Manual Page -- http://www.php.net/manual/en/language.namespaces.definition.php
Edit -- https://master.php.net/note/edit/81443
Del: integrated -- https://master.php.net/note/delete/81443/integrated
Del: useless -- https://master.php.net/note/delete/81443/useless
Del: bad code -- https://master.php.net/note/delete/81443/bad+code
Del: spam -- https://master.php.net/note/delete/81443/spam
Del: non-english -- https://master.php.net/note/delete/81443/non-english
Del: in docs -- https://master.php.net/note/delete/81443/in+docs
Del: other reasons-- https://master.php.net/note/delete/81443
Reject -- https://master.php.net/note/reject/81443
Search -- https://master.php.net/manage/user-notes.php