I've noticed that ZF2 has names like \Zend\Debug\Debug, and while there is
some duplication here, it makes some sense.  

For example, working with BjyAuthorize I see some names that break up this
structure. For example, 
BjyAuthorize\Provider\Role\ObjectRepositoryProvider.php
<https://github.com/bjyoungblood/BjyAuthorize/blob/master/src/BjyAuthorize/Provider/Role/ObjectRepositoryProvider.php>
  

The way it is now, it is not immediately clear what
"ObjectRepositoryProvider.php" provides.  To know this, you need to look at
the entire namespace where that class lives, and deduce what the class
provides from namespace.

I think a more descriptive name may be "ObjectRepositoryRoleProvider.php"
Reading the name you know what the class provides and from where.

But why not go further?   I am considering whether naming is to be more
general or more specific.

For example, while the class above does not state which Object Repository it
is using inside, it is using Doctrine.  Why not call the class
"DoctrineRoleProvider.php"?  Nice, specific, clear, and concise. 

I suppose that slightly more general name, like
"ObjectRepositoryRoleProvider.php" means that you do not have to rename a
whole lot of classes, should you switch from Doctrine to another object
store later.  Still, though you'd have to do an awful lot of internal
Doctrine to X renaming inside your source code.  And, should you switch
back, you need to undo all those changes as well.  I guess that also depends
on source control software, and how it likes or dislikes renaming files.  

But basically, I wanted to ask - in general, where does one lean when naming
files?
*  General (Object Repository) vs Specific (Doctrine)
*  Repeat part of namespace in your class to make class name more
descriptive (Role\DoctrineRoleProvider) or not (Role\DoctrineProvider)



--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Questions-on-Naming-tp4661484.html
Sent from the Zend Framework mailing list archive at Nabble.com.

-- 
List: fw-general@lists.zend.com
Info: http://framework.zend.com/archives
Unsubscribe: fw-general-unsubscr...@lists.zend.com


Reply via email to