[RFC|Merged] Autoloading & Class Naming Convention

These requests for comments/change have lead to an implemented feature that has been successfully merged into the 3.1/Ascraeus branch. Everything listed in this forum will be available in phpBB 3.1.
User avatar
DavidIQ
Customisations Team Leader
Customisations Team Leader
Posts: 1904
Joined: Thu Mar 02, 2006 4:29 pm
Location: Earth
Contact:

Re: [RFC|Merged] Autoloading & Class Naming Convention

Post by DavidIQ »

naderman wrote:I agree entirely. MODs should be in includes/mod/<modname> and follow the standard conventions. Making the auto loader generic so you can use another instance for loading from a different location makes sense, but should not be encouraged for regular MODs.
Agree as well.
Image

User avatar
rxu
Registered User
Posts: 164
Joined: Tue Apr 04, 2006 4:28 pm
Contact:

Re: [RFC|Merged] Autoloading & Class Naming Convention

Post by rxu »

My concern here is what do we actually define as <modname>.
Here are some examples of MODs names (no idea if they could use classes, just f.e.):
Multiple File Upload(addon for UserBlogMod)
Living Avatars Member Control Panel Integration
Security Blanket Spam Blocker by Area-51-X.com
Having folders like Security_Blanket_Spam_Blocker_by_Area-51-X.com and corresponding classes like phpbb_class_Security_Blanket_Spam_Blocker_by_Area-51-X.com_whatever would be a headache.
We need some guideline about naming <modname> then.
Image

User avatar
DavidIQ
Customisations Team Leader
Customisations Team Leader
Posts: 1904
Joined: Thu Mar 02, 2006 4:29 pm
Location: Earth
Contact:

Re: [RFC|Merged] Autoloading & Class Naming Convention

Post by DavidIQ »

That would be part of the guidelines that are included with the package. Something like:
  • All lower cased letters
  • No special characters (with the exception of hyphens maybe?)
  • Must be standard alphabet letters (I.e. No accented letters)
Right now there are some coding guidelines present in the phpBB package. Would just be a matter of you guys updating them and us enforcing them.
Image

User avatar
rxu
Registered User
Posts: 164
Joined: Tue Apr 04, 2006 4:28 pm
Contact:

Re: [RFC|Merged] Autoloading & Class Naming Convention

Post by rxu »

Think we probably can just add a requirement of shortened names for MODs.
Thus MOD will have a regular, not restricted by characters and/or length, descriptive name and a shortened one that should be used to name folders and classes the MOD creates.
Image

User avatar
naderman
Consultant
Posts: 1727
Joined: Sun Jan 11, 2004 2:11 am
Location: Berlin, Germany
Contact:

Re: [RFC|Merged] Autoloading & Class Naming Convention

Post by naderman »

I'd say the MOD can pick whatever directory name they feel like which follows naming conventions. Typically it'll end up being something short, cause you actually need to use it in class names. This however brings me back to wondering if using _ for both directory seperation and word seperation in a name makes sense. Maybe we should actually use two different characters in class names to distinguish the directories/namespaces from each other and words within a directory/namespace.

User avatar
nickvergessen
Former Team Member
Posts: 733
Joined: Sun Oct 07, 2007 11:54 am
Location: Stuttgart, Germany
Contact:

Re: [RFC|Merged] Autoloading & Class Naming Convention

Post by nickvergessen »

So you want folder-location_class-name to result in includes/folder-location/class-name.php
and folder_location-class_name in includes/folder/location-class/name.php
Member of the Development-TeamNo Support via PM

User avatar
naderman
Consultant
Posts: 1727
Joined: Sun Jan 11, 2004 2:11 am
Location: Berlin, Germany
Contact:

Re: [RFC|Merged] Autoloading & Class Naming Convention

Post by naderman »

Yeah something like that, just not sure about the character to use, - looks a bit cofusing from your examples, don't you think?

igorw
Registered User
Posts: 500
Joined: Thu Jan 04, 2007 11:47 pm

Re: [RFC|Merged] Autoloading & Class Naming Convention

Post by igorw »

I think it's a bad idea. With my initial class name proposal (without autoloading) this would have been possible. But imo, if people want to namespace stuff, they should just add another subfolder.

Post Reply