Re: Duplicating code between packages.
| From: | Pierre-Alain Joye | Date: | Fri, 13 Jun 2003 09:25:01 +0000 |
| Subject: | Re: Duplicating code between packages. | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-17384@lists.php.net to get a copy of this message | ||
On Thu, 12 Jun 2003 23:14:02 +0100
Peter Bowyer <peter@mapledesign.co.uk> wrote:
> Hi,
>
> In the Image_Transform NetPBM driver I need to use two of the methods
> from the file package (getTempFile() and getTempDir()). Should I
> include this package in the code, creating an extra dependency and
> adding another 500+ lines of code, or should I instead duplicate these
> two methods in my driver? If I was using C I'd do the former, but for
> PHP is the latter better?
If we keep an extra dependency, you may use the one available
System.php. There are more chances to see it already included somewhere
else than File.
Duplicating the code is sometimes usefull to avoid too much
dependencies. However, I prefer to do not duplicate this specific code.
Temp folders and files can be a really pain to work with, PEAR solves
much of them. In somedays, it should even use the user config settings
directly, keeping the whole thing consistent.
hth
pierre