[Owncloud] namespacing

Arthur Schiwon blizzz at owncloud.com
Wed Jul 25 16:33:06 UTC 2012


A follow up on this.

The suggestion was actually to use \OCA_appid\ as namespace, what i did 
was to support the pattern \OCA\appid\ in the autoloader.

The first pattern is e.g. used in the app files_version

namespace OCA_Versions;
class Hooks { .. }

Having two different approaches is of course bad style and should be 
avoided. Frank and I wonder now, what the better and more intuitive way 
is: \OCA_appid\ or \OCA\appid\

Thoughts, opinions?

Cheers
Arthur


On 07/25/2012 01:05 PM, Arthur Schiwon wrote:
> Digging up this...
>
> On 04/23/2012 05:23 PM, Frank Karlitschek wrote:
> <....>
>>> So lets use the OC, OCP and OCA_<appid> namespaces.
>>
>> I heard that this wasn´t clear enough.
>> Yes. We use the PHP namespaces :-)
>
> <....>
>
> I refactored my LDAP app a bit and while doing so i extended our
> autoload function with support for the OCA namespace.
>
> E.g. i can have now stuff like this in apps/user_ldap/ and this way
> extend a class in apps/user_ldap/lib/
>
> namespace OCA\user_ldap;
>
> class USER_LDAP extends lib\Access { ... }
>
>
> It is not forced to use a namespace, other apps will work as they did
> before. Nevertheless, since we agreed some time ago on using those
> namespaces it's not a bad idea to switch to this pattern, betimes.
>
> Cheers
> Arthur




More information about the Owncloud mailing list