Capitalize Namespace Names?

349 views
Skip to first unread message

Paul M Jones

unread,
Jun 7, 2011, 4:09:24 PM6/7/11
to aur...@googlegroups.com
Hi all,

This seems like a small detail, but it may be important later.

In PHP 5.3 land, there are only two projects using lower-case for namespaces that I know of: Aura and Lithium. I.e., we have vendor\package\ClassName.

All the others (Zend, Symfony and its attached projects, Fuel, etc) are using capitals for their names: Vendor\Package\ClassName.

I'm thinking, to stay with what appears to be a community standard, we should use capitals as well. It probably means renaming the Git repos from aura.package to Aura.Package to keep with that.

Does anyone here have strong feelings about it one way or the other?


--

Paul M. Jones
http://paul-m-jones.com/

Mike van Riel

unread,
Jun 7, 2011, 4:17:18 PM6/7/11
to aur...@googlegroups.com
+1 from my point of view.

By not having those first few characters uppercase Aura might not
(strictly) correspond to the PSR-0 and thus some picky auto-loaders
might have trouble with it.

And I think it looks prettier; but that is personal ;)

Hari K T

unread,
Jun 8, 2011, 1:02:21 AM6/8/11
to aur...@googlegroups.com
I am ok with it . So +1 . But some thoughts below .

Hari K T
M: +91-9388758821 | W: http://harikt.com
kthari85   kthari85  kthari85




On Wed, Jun 8, 2011 at 1:47 AM, Mike van Riel <mike.v...@naenius.com> wrote:
+1 from my point of view.

By not having those first few characters uppercase Aura might not
(strictly) correspond to the PSR-0 and thus some picky auto-loaders
might have trouble with it.

And I think it looks prettier; but that is personal ;)

On Tue, 2011-06-07 at 15:09 -0500, Paul M Jones wrote:
> Hi all,
>
> This seems like a small detail, but it may be important later.
>
> In PHP 5.3 land, there are only two projects using lower-case for namespaces that I know of: Aura and Lithium.  I.e., we have vendor\package\ClassName.
>
> All the others (Zend, Symfony and its attached projects, Fuel, etc) are using capitals for their names:  Vendor\Package\ClassName.

OK. So namespace will be caps for first word .

Eg :  Vendor\Package\ClassName.
 
>
> I'm thinking, to stay with what appears to be a community standard, we should use capitals as well.  It probably means renaming the Git repos from aura.package to Aura.Package to keep with that.

But what about naming Aura.packge ? p as small letter itself ? 

My thoughts are because in this case ucfirst() and strtolower() will work . Else we may want to use some function to deal with it .

Any thoughts ? 

Also capitalization doesn't looks good after the dot  ( Personal opinion ) .

Namespace is caps for first word itself  Vendor\Package\ClassName.

Paul M Jones

unread,
Jun 8, 2011, 10:13:58 AM6/8/11
to aur...@googlegroups.com

On Jun 8, 2011, at 00:02 , Hari K T wrote:

> I am ok with it . So +1 . But some thoughts below .
>

> On Tue, 2011-06-07 at 15:09 -0500, Paul M Jones wrote:
> > Hi all,
> >
> > This seems like a small detail, but it may be important later.
> >
> > In PHP 5.3 land, there are only two projects using lower-case for namespaces that I know of: Aura and Lithium. I.e., we have vendor\package\ClassName.
> >
> > All the others (Zend, Symfony and its attached projects, Fuel, etc) are using capitals for their names: Vendor\Package\ClassName.
>
> OK. So namespace will be caps for first word .
>
> Eg : Vendor\Package\ClassName.

Correct.


> > I'm thinking, to stay with what appears to be a community standard, we should use capitals as well. It probably means renaming the Git repos from aura.package to Aura.Package to keep with that.
>
> But what about naming Aura.packge ? p as small letter itself ?
>
> My thoughts are because in this case ucfirst() and strtolower() will work . Else we may want to use some function to deal with it .

I thought about that, but the package name is part of the namespace name. For consistency between the package names and the namespace names, the namespace Vendor\Package should be represented as Vendor.Package (note the capital p) in the filesystem.

Regarding transformations between package and namespace names, I don't imagine it's going to be a big deal. In all cases I can think of, we have explicit mappings in config for that kind of thing. Is there something in particular you had in mind that presents a problem?


> Also capitalization doesn't looks good after the dot ( Personal opinion ) .

Yeah, I hear you. Personally I prefer the "lowercase namespace, capital class" convention, but that does not appear to have taken hold in the community. (What has taken hold is a direct translation of the PEAR_Naming_Convention from underscores to backslashes.) Sometimes you have to give up the little things. :-/

Hari K T

unread,
Jun 9, 2011, 12:25:08 AM6/9/11
to aur...@googlegroups.com
I am ok with it ,

But what about naming Vendor/Package ( two directory ) directory than Vendor.Package ( single directory )


Hari K T
M: +91-9388758821 | W: http://harikt.com
kthari85   kthari85  kthari85




Paul M Jones

unread,
Jun 9, 2011, 9:56:28 AM6/9/11
to aur...@googlegroups.com

On Jun 8, 2011, at 23:25 , Hari K T wrote:

> I am ok with it ,
>
> But what about naming Vendor/Package ( two directory ) directory than Vendor.Package ( single directory )

Having a two-directory structure was my initial desire. In a lot of ways I prefer it, the same way I prefer having a single include-path and symlinking packages into it: it suits my organizational compulsions.

However, the 2-dir structure means you have to go through at least one more step when bringing in a package from another vendor. You have to make a directory for that vendor, make sure it's named properly, and then put the vendor package in place. With a 1-dir structure, you can download a package directly from Github and drop it into place. Much as I like the 2-dir idea, the 1-dir is easier all around, at little cost to the organizational structure.

Mike van Riel

unread,
Jun 9, 2011, 10:10:31 AM6/9/11
to aur...@googlegroups.com
Although I can see your point about reducing the effort needed to add
packages I think that adding one additional directory won't make the
difference.

Many Frameworks and/or Libraries require a top level folder (TLF); take
for example Zend Framework, which has Zend as TLF. Not to mention
symfony which requires you to create lib/vendor/symfony and then run an
installation script.

What I am trying to say is: People are used to placing their libraries
in a predefined folder structure.

If we really want to make it simple then drop-in distribution as a phar
archive combined with a 'aura install <package>' like command might mean
less hassle for developers. Though I do not know how feasable that is
(and how far off that is from the PEAR way of things).

My 2 cents

Paul M Jones

unread,
Jun 9, 2011, 10:17:05 AM6/9/11
to aur...@googlegroups.com

On Jun 9, 2011, at 09:10 , Mike van Riel wrote:

> Although I can see your point about reducing the effort needed to add
> packages I think that adding one additional directory won't make the
> difference.
>
> Many Frameworks and/or Libraries require a top level folder (TLF); take
> for example Zend Framework, which has Zend as TLF.

One difference here is that ZF is a monolithic distribution. You download the whole thing all at once, not several packages individually to mix-and-match.


> Not to mention
> symfony which requires you to create lib/vendor/symfony and then run an
> installation script.

I'd rather avoid an installation script. We have `update.php` right now, but that's specifically for while we're in development. The plan is to make the system use Git submodules if possible.


> What I am trying to say is: People are used to placing their libraries
> in a predefined folder structure.

Sure. All I'm saying is that the 2-level structure isn't free, even though I like it better in some ways.

There are other considerations as well. For example, I'd like for people to be able to match their Github (or whatever) repos to the package directory. In a 2-dir structure, that might mean the username and then the repo name; in a 1-dir structure, it's just the repo name.


> If we really want to make it simple then drop-in distribution as a phar
> archive combined with a 'aura install <package>' like command might mean
> less hassle for developers. Though I do not know how feasable that is
> (and how far off that is from the PEAR way of things).

PHAR performance is not that fantastic. And that adds a little extra development work; you have to PHAR up your package for distribution, vs. making it a plain download from Github. (Tradeoffs, always with the tradeoffs.)

Hari K T

unread,
Jun 10, 2011, 12:09:54 PM6/10/11
to aur...@googlegroups.com
Just a brief about the discussion me and Paul M Jones made at IRC. In case if you missed it .

I was having a thought of components named as github.com/auraphp/View , Router etc for we will be using the name space as Aura/View , Aura/Router

But later the talk with pmjones made it more clearly , and it sounds good .

"now, let's say you (harikt) want to create a package in another namespace, under your own account
you can't, because the convention is Username/PackageName
with the single directory and dots, you can fork or create a pacakge in any namespace you like, using the namespace.package convention"

This way we can just clone the repo to the package directory . We don't want to create the vendor directory and clone and also don't want to bother what the top level vendor name has been assigned .

So that sounds good . ie was a gr8 idea and nice point . So lets move with the same idea of Aura.Router , Vendor.Package

+2 ;)


Hari K T
M: +91-9388758821 | W: http://harikt.com
kthari85   kthari85  kthari85




Paul M Jones

unread,
Jun 13, 2011, 6:27:39 PM6/13/11
to aur...@googlegroups.com
Hi all,

Per the outcome of this discussion, I am about to rename all the "aura.package" Github repositories to "Aura.Package". I will email the list when it's done, and provide what notes I can about upgrading your systems.

Paul M Jones

unread,
Jun 13, 2011, 9:31:26 PM6/13/11
to aur...@googlegroups.com
On Jun 13, 2011, at 17:27 , Paul M Jones wrote:

> Per the outcome of this discussion, I am about to rename all the "aura.package" Github repositories to "Aura.Package". I will email the list when it's done, and provide what notes I can about upgrading your systems.

It is accomplished! You should be able to upgrade like so, from your Aura system directory:

# get rid of lower-case aura packages
rm -rf package/aura.*

# get the newest system updates
git pull

# run update.php to get the upper-case Aura packages
php update.php

At the worst, you can clone the system again and run `php update.php` to get the new packages.

Note that the Exceptions used to be Exception_Whatever, and are now Exception\Whatever. Similarly, web\hello_world (and the like) are now Web\HelloWorld.

Please let me know if you have any problems.

Hari K T

unread,
Jun 13, 2011, 11:31:16 PM6/13/11
to aur...@googlegroups.com
Good work .
Will test something and let you know ;) .

Hari K T
M: +91-9388758821 | W: http://harikt.com
kthari85   kthari85  kthari85




Reply all
Reply to author
Forward
0 new messages