Re: Net_FTP design issues
| From: | Tobias Schlitt | Date: | Thu, 14 Oct 2004 16:44:21 +0000 |
| Subject: | Re: Net_FTP design issues | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-33853@lists.php.net to get a copy of this message | ||
Hi Greg Beaver!
On 10/14/2004 11:10 AM you wrote:
On the other hand, if native ftp is available, one can't include the code at all. This will make the user's job much more complex. Instead ofI would have a depending include of the socket based code, wether the FTP extension is available or not. I guess there's no sense in using a socket based implementation, if a C based solution exists.
<?php require_once 'Net/Ftp.php'; ?> we will then have to go <?php if (!function_exists('ftp_whatever')) {This would be done inside the main Net/FTP.php file. It will check if native FTP is available and include the socket based code, if not.include_once 'Net/Ftp.php';} ?>
Also, what if you decide you want to add new functionality later? You can't. Procedural code is completely inappropriate for a package like Net_FTP.The main benefit would be, that people who wanna use a script depending on the FTP extension can do so without changing the script, even if they don't want to use the Net_FTP class.
This also smacks of greater-than-needed complexity in the implementation. Better is to expect that speed-hungry users will use the native ftp functions no matter what, and that everyone else will welcome the abstraction that allows a redistributable application to run without the ftp extension dependency.
A good compromise solution is to provide a file that has wrapper functions to the procedural functions. This will satisfy the users who want to only use the procedural stuff.This would mean complete code changes (which I wanted to avoid in the PHP4 version of Net_FTP) to Net_FTP itself. The function based solution would allow us to just include the code conditionally and let the Net_FTP class run under any kind of circumstances. Thanks for your comments, Greg! Regards, Toby -- Tobias Schlitt GPG Key: 0xA6529579 a passion for php http://www.schlitt.info Like to say "thank you"? - http://pear.php.net/wishlist.php/toby