Re: Breaking BC and releases

From: Date: Fri, 25 Oct 2002 22:05:41 +0000
Subject: Re: Breaking BC and releases
References: 1 2  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-10263@lists.php.net to get a copy of this message
I'm currently working on implemention of the pear error class. Once it's in place I think it would be a good idea to do this. We're going to have to re-work the error handling in modules a bit too, but we can do that over time. +1 from me! Adam > I don't know if this has been mentioned (my mail server went offline, so > I'm still catching up with bounce retrys), but how about doing things > the Horde way... in using a ::factory method, which will return either > an error (code?), or a reference to the new object, such as. > > $p = &File_Passwd::factory('.htaccess'); > if (File_Passwd::isError($p) { > echo $p->getMessage(); > } else { > $p->modUser('user', 'pass'); > $p->close(); > } > > That way you get the convineance of a constructor, without messing up > the PEAR error handling. > > Jon Wood > > ----- Original Message ----- > From: "Mika Tuupola" <tuupola@appelsiini.net> > To: <pear-dev@lists.php.net> > Sent: Friday, October 25, 2002 2:08 PM > Subject: [PEAR-DEV] Breaking BC and releases > > >> >> I talked with Rasmus and I'll start maintaining File_Passwd. >> There is one thing which I would like to fix, but it will break >> BC and I'd like some input from the list what is the proper >> way of releasing a BC breaking release. >> >> Currently lots of things which can cause an error are done >> in the constructor (opening and reading files etc). Since you >> can't properly use PEAR error handling from constructor >> I would like to introduce a load() or init() method which does >> all the loading etc. >> >> Before you would do something like this: >> >> $p = new File_Passwd('.htaccess'); >> $p->modUser('user', 'pass'); >> $p->close(); >> >> After the fix you could do something like: >> >> $p = new File_Passwd('.htaccess'); >> $p->load(); >> $p->modUser('user', 'pass'); >> $p->close(); >> >> or if you want the error handling: >> >> $p = new File_Passwd('.htaccess'); >> if (PEAR::isError($p->load())) { >> // do error handling >> } else { >> $p->modUser('user', 'pass'); >> $p->close(); >> } >> >> I see two possibilities. >> >> 1) first make a 0.9 beta release with the original broken >> behaviour and then 1.0 release with working error handling but >> broken bc and then fix other packages depending on File_Passwd >> >> Or should the numbers be 1.0 and 2.0 ? >> >> 2) leave the package as it is and make release only with broken >> error handling. Less fuss, but is still broken and it will be >> even more harder to fix in the future when there are more >> dependencies than now. >> >> >> >> Actually browsing through cvs there is quite a lot of code >> in PEAR witch broken error handling. For example all >> Auth_Container_xxx, some Image_Transform_Driver_xxx, Config >> to name few. I think this needs to be addressed if PEAR >> is considered "hiqh quality code". >> >> >> >> -- >> Mika Tuupola RÌÚi�<5“í۹ >> nhttp://www.appelsiini.net/~tuupola/ >> >> >> -- >> PEAR Development Mailing List (http://pear.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> > > > -- > PEAR Development Mailing List (http://pear.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php --------------------------------- Adam Morton Developer - Electronic Student Services http://phpwebsite.appstate.edu President - ASU Linux Users Group

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