[Coding Standards] Loading all files at once
| From: | Paul M Jones | Date: | Mon, 09 Jul 2007 20:32:15 +0000 |
| Subject: | [Coding Standards] Loading all files at once | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-47302@lists.php.net to get a copy of this message | ||
The proposed coding standard states:
Loading all files at once
PEAR2/PackageName/allfiles.php is the "load all classes at once for easy startup and opcode caches friendliness" so that, for instance, the file might contain:
<?php
// note the lack of dependency on include_path - essential for beginners
if (!class_exists(PEAR2_Exception)) {
class PEAR2_Exception extends Exception {}
}
require dirname(__FILE__) . '/Base.php';
require dirname(__FILE__) . '/Exception.php';
require dirname(__FILE__) . '/Drivers/Common.php';
require dirname(__FILE__) . '/Drivers/Simple.php';
require dirname(__FILE__) . '/Drivers/Fancy.php';
?>
I don't think this should be a *requirement* at all. I agree that developers who *want* to provide this kind of functionality should abide by a standard way of doing it, but making it a requirement for each package seems like overkill to me (esp. for very large packages with adapters and plugin systems, like Text_Wiki and MDB2). I have heard the "it makes things easier for opcode caches" argument, but I don't find it especially strong.
This seems very much like a "recipe" or "practice" candidate to me, not a coding standard by which package acceptance or denial will be judged.
--
Paul M. Jones <http://paul-m-jones.com>
Solar: Simple Object Library and Application Repository
for PHP5. <http://solarphp.com>
Join the Solar community wiki! <http://solarphp.org>
Savant: The simple, elegant, and powerful solution for
templates in PHP. <http://phpsavant.com>