ElkArte Community

Title: Classes naming
Post by: emanuele on May 29, 2014, 09:46:00 am
I was looking around at the classes in /subs/, and... well, at the moment there are some naming variants:
I see these patterns mainly:
Then some completely unrelated class names with file names.
And finally some special cases (search, control verification <= I should fix that, payment gateways).

What would you like best?
I think now it's one of the last moments to pick one and be happy for the 1.x line.

I think the first is the most "autoloading-friendly".
Title: Re: Classes naming
Post by: Spuds on May 29, 2014, 11:15:31 am
Where is the poll  :'(   :P

I think 1 is the way to go and then I need is a way to remember that !

Title: Re: Classes naming
Post by: TE on May 29, 2014, 11:18:05 am
I'd vote for one, too  :)
Title: Re: Classes naming
Post by: emanuele on May 29, 2014, 02:23:23 pm
And here it is:
https://github.com/elkarte/Elkarte/pull/1593
:D

Try to review/test it before merging because I didn't. O:-)
I'll try to test something later.
Title: Re: Classes naming
Post by: Joshua Dickerson on May 29, 2014, 09:27:10 pm
I'd use PSR compliant names: SomethingElse in SomethingElse.php
Title: Re: Classes naming
Post by: emanuele on May 30, 2014, 03:38:47 am
Yeah, that could have been a solution, though it would have meant a rewrite of a lot of stuff in the first place...
Yesterday evening just after this was merged I was playing with an autoloader and it worked "quite well" (few problems with specific classes like search, payments, database), but overall it worked fine! :D
/me wanted a naming convention because of the autoloader. :P
In the end the "_" is good because it helps identify the different kind of classes we have that need "special" rules for the autoload.

The next step for 1.1 will be to harmonize the /sources/admin directory naming, so that we could guess the place of a class just by its name and not having to use file_exists.
Title: Re: Classes naming
Post by: emanuele on May 30, 2014, 04:15:18 pm
https://github.com/emanuele45/Dialogo/compare/elkarte:development...autoloader?expand=1 O:-)
Not yet ready to merge.
Title: Re: Classes naming
Post by: emanuele on June 13, 2014, 11:51:08 am
Reminder bump: write these on the wiki somewhere.