Re: Re: PEAR2 Coding standards, Autoloading and Namespaces

From: Date: Tue, 08 Apr 2008 08:24:16 +0000
Subject: Re: Re: PEAR2 Coding standards, Autoloading and Namespaces
References: 1 2 3 4 5 6  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-49696@lists.php.net to get a copy of this message
On Apr 6, 2008, at 6:26 AM, Greg Beaver wrote:
Jeff Moore wrote:
On Apr 4, 2008, at 5:28 AM, Greg Beaver wrote:
Also incorrect, phpDocumentor doesn't even care or know about namespace as this is not an enforced relationship the way a java package is.
I presume that someday phpDocumentor will be aware of namespaces. I have no idea if that implementation will attempt to be done on the @package axis, or if there would be a separate axis for namespaces.
Let's think of another example: the PEAR package and the PEAR_PackageFileManager package. These are not subpackages, but are related. Currently PEAR's files go into PEAR/ and PEAR_PackageFileManager class go into PEAR/PackageFileManager. Would you suggest the classname for a similar class be PEAR2::Pyrus_PackageFileManager::PackageFileManager or PEAR2::Pyrus::PackageFileManager::PackageFileManager?
Well, I think PackageFileManager is an incredibly verbose class name in a world of namespaces. Why not simply call the class Manager, making the fully qualified name PEAR2::Pyrus_PackageFileManager::Manager? Now I also think Pyrus_PackageFileManager is an incredibly verbose package name, but I don't presume to know how to shorten that.
If you all feel strongly about changing this issue even after my strong objections, I suggest you follow the official path and propose an RFC to the PEAR Group for changes to the PEAR2 coding standards (which are up for review, by the way).
There are several issues that have been discussed. 1.) Travis' proposal for lowercasing package names. I like this. I can see this as a proposal. 2.) Mapping package names to namespaces. I suggested this because it was possible, and to find out what people thought of it. If its a bad idea, then thats that. I have no strong feelings on this point and as it might conflict with #1, I favor that naming convention over this one. 3.) Directory organization in subversion to support svn:externals. I think this is an idea worth exploring, but I don't use svn:externals, so I'm not going to pursue this point. 4.) Should every package declare a namespace? As you said earlier, Greg, "existing coding standards require 2 segments like Foo_Bar." I leave that to others to resolve. 5.) Should namesake classes go inside the namespace or outside? I think you overestimate the trouble that the "inside" method causes and underestimate the trouble that the "outside" method causes. I can see merit in both. Maybe what is needed is a rule on when to use one or the other. What that rule is escapes me for now. I'm going to keep thinking about this. I use the PEAR coding standards and promote them to others. I saw that the PEAR2 standard covered namespaces. I also thought that PEAR2 and namespaces might be opportunities to think outside the box. Since I had questions about best practices with namespaces, I came here. But, perhaps this isn't the right venue for this kind of discussion. Perhaps its also too early in the 5.3 cycle to codify rules for using namespaces. Best Regards, Jeff

« previous php.pear.dev (#49696) next »