BC solution for Alexey's good point :)

From: Date: Fri, 26 Sep 2003 22:30:38 +0000
Subject: BC solution for Alexey's good point :)
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-22101@lists.php.net to get a copy of this message
Hi all, Alexey raises a really good point - if there are only small BC breaks, the user is still forced to rename every single element in his/her use of the package in order to upgrade easily with the new BC RFC. I have a solution ripped from an offlist email by Josh Eichorn. A wrapper file can be provided that contains elements similar to this: <?php if (class_exists('MDB')) {
    trigger_error("Cannot use MDB_v2 wrapper: MDB 1.x is already in use", E_USER_ERROR);
} class MDB extends MDB_v2 { } define('MDB_ERROR_BLAH', MDB_V2_ERROR_BLAH); ?> Then, a user can simply change the require_once statements with a cut and paste: require_once 'MDB.php'; becomes require_once 'MDB/v2/MDB1wrapper.php'; The name is negotiable, in fact I don't care what it is called, just as long as the wrapper can be easily loaded. This system is already used quite successfully by DB users who wish to switch to MDB, and metabase users who wish to switch to MDB, which proves that the idea works in practice as well as in theory. With this addition to the RFC, there are no problems. If the user decides to totally migrate to MDB v2.x, he/she can do the work involved to search-and-replace MDB to MDB_v2 (case-sensitive) and MDB_ERROR to MDB_V2_ERROR, etc. Now, users who, like Daniel's example of the grocery store using HTML_TreeMenu for navigation, need not worry, because they can be guaranteed that the HTML_TreeMenu package will always work for them. If they hire some nerd later to fix up their site, he/she can migrate to version 2.x as HTML_TreeMenu_v2 easily enough, and use the wrapper very quickly if, for instance, they are only contracted for 5 hours of paid work to update the whole site. Regards, Greg

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