Re: [Coding Standards] Loading all files at once

From: Date: Mon, 09 Jul 2007 20:42:40 +0000
Subject: Re: [Coding Standards] Loading all files at once
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-47303@lists.php.net to get a copy of this message
Paul M Jones wrote:
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. Having includes strewn throughout all your files allows gives us the current include_path mess and makes it impossible to use an autoloader if you want to. How do you propose we solve these problems if we don't drop the includes out of the files.
-josh

« previous php.pear.dev (#47303) next »