Re: Why change require_once? A brief explanation of motives
| From: | Sebastian Mendel | Date: | Tue, 17 Jul 2007 09:31:55 +0000 |
| Subject: | Re: Why change require_once? A brief explanation of motives | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-47543@lists.php.net to get a copy of this message | ||
Greg Beaver schrieb:
> In addition, the use of require_once automatically limits PEAR packages
> to use on disk. phar archives are required to modify the source in
> order to use the package, resulting in a significant possibility of
> accidental error introduction when post-processing the source.
i cannot understand this, i using PEAR a long time now, installed or
shipped, i never had any problems with include_path ...
and would it not be easy to circumvent this by just using
include dirname(__FILE__) . '/somefile.php';
include dirname(__FILE__) . '/SubClass/Class.php';
include dirname(dirname(__FILE__)) . '/Pear.php';
??
sorry if i am totally wrong ...
> The new coding standards are designed to eliminate these problems all at
> once. There are two separate approaches to this:
at what cost?
including a huge amount of files not needed
if speed is the problem, why using OOP at all? ;-)
> The most common complaints about PEAR are (in order)
>
> 1) you have to install things
> 2) you have to set up include_path
^^ this depends on the package
> 3) there's base classes required that are all non-PHP things (PEAR and
> PEAR_Error)
^^ depends an package too
> 4) bloat
^^ yes, hell, this will be fixed with allfiles.php ...
> Users would simply need to either use allfiles.php, autoload, or if
> performance is an issue, they can do:
>
> <?php
> require '/full/path/to/Another/Class.php';
> require '/full/path/to/Blah.php';
> ?>
what about if they just want to use it like they did it all the time?
<?php
require 'MyPearClass.php';
// MyPearClass includes subclasses only if required
$MyPearSubClass = MyPearClass::factory('somesubclass');
?>
with your solution above, the user needs to decide what classes he wants,
why complicate it this way?
for example in MDB2 currently you have to load about two classes MDB2 and
the driver
with allfiles.php it will load at least 18 classes
18 classes, just for a simple database connection ...
18 classes in allfiles.php is faster than just two classes with classic
require_once, using APC?
i just think that this is wrong approach to the problems mentioned ...
--
Sebastian Mendel
www.sebastianmendel.de