![]() |
Some questions
Hi all, glad this project finally got started!
I'm about to start work on making the codebase a little cleaner but have a question: How are we naming files? Not entirely sure from the forums, but I'd like so suggest something like: class_classname.php & interface_intname.php. I've used the period separated version before but I think that using underscores is a better method. Periods are meant for separating the filename from the extension really.I couldn't find any posts on this - let me know if I didn't look hard enough :) Thanks, |
VI might correct me, but as far as I'm aware we're using the period separator:
class.myclass.php That said, at this early stage things are still in a state of flux so may change. |
That's fine. I've just thought of something though - are we planning to take advantage of PHP5's class/interface autoloading? What is the minimum version of PHP we are supporting anyway (at least 5.1 I'd have thought).
Anyway, I was writing an autoload function to use the class/interface.name.php - can you see what's wrong below?PHP Code:
class Class_ClassName and interface Interface_InterfaceName.I'm actually thinking a better method could be to stip out the class/interface part of the filename altogether now. |
Quote:
Quote:
Quote:
|
I understand replacing the periods, that makes sense, but why strip out the layer that we put the class files in?
|
Quote:
My reasoning is that if we use an autoload (which makes things mcuh easier) there's no way to tell whether it's an interface or a class that needs to be loaded. Stripping out that identifier from the name makes things a little easier. Otherwise we'd have to include both class_name.php and interface_name.php (which isn't too good) and check which one wasn't included. Thinking about it, the require in my method should be an include - otherwise it will just fatal the app before we even get to the exception. |
I thought you meant something else. Sounds like a good idea.
|
Another thing, what do you think about prefixing classes with Phlox_?
I've started to do that on the Registry/Config classes (I suppose it stops clashes with other libraries) but I'm not a huge fan of it - I'd prefer Registry::getInstance to Phlox_Registry::getInstance. Not a huge issue, but something to get out of the way early on.Also: If you're online get in the irc channel! No point me being on my own in here =P |
I don't see why not, the cleaner the better.
|
Agree with Village Idiot. the cleaner the better.
|
| All times are GMT. The time now is 12:26 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0