__autoload
Posted: Sun Jun 03, 2007 4:27 pm
I've decided to look into using __autoload as a magical way to include my classes. Forever and a day I have disliked this idea for the following reasons:
1) Auto-magic techniques are difficult to figure out when you first walk into a new code base - unless well document which usually isn't the case
2) I've liked having the include dependencies handled by the class module itself. This also makes dependency browsers easier to write and as well makes code code easier to follow when stepping through file by file.
However the idea of a centralized include module is just more appealing than hundreds and possibly thousands of files all linking to each other.
1) Easier maintenance and logging would tell me alot about of dependencies
2) Better performance in avoiding duplicate inclusions (even using include_once)
The idea is simple, the class name is mapped to a physical directory using a simple array (class names don't map to directory directly as in Zend).
Maybe some trivial logging facility so I can see what files are needed on which request and can use that to navigate the directory structure and open appropriate files.
Anything else you can think of I might want to add to a quasi service locator type file such as this?
Cheers
1) Auto-magic techniques are difficult to figure out when you first walk into a new code base - unless well document which usually isn't the case
2) I've liked having the include dependencies handled by the class module itself. This also makes dependency browsers easier to write and as well makes code code easier to follow when stepping through file by file.
However the idea of a centralized include module is just more appealing than hundreds and possibly thousands of files all linking to each other.
1) Easier maintenance and logging would tell me alot about of dependencies
2) Better performance in avoiding duplicate inclusions (even using include_once)
The idea is simple, the class name is mapped to a physical directory using a simple array (class names don't map to directory directly as in Zend).
Maybe some trivial logging facility so I can see what files are needed on which request and can use that to navigate the directory structure and open appropriate files.
Anything else you can think of I might want to add to a quasi service locator type file such as this?
Cheers