[PEPr] Comment on XML::Query2XML

From: Date: Tue, 28 Feb 2006 16:04:03 +0000
Subject: [PEPr] Comment on XML::Query2XML
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-41547@lists.php.net to get a copy of this message
Justin Patrin (http://pear.php.net/user/justinpatrin) has commented on the proposal for XML::Query2XML. Comment: There are lots and lots of exceptions in here. It's IMHO OK to have lots of Exceptions instead of codes as long as you your exceptions are extended from more general exceptions. I haven't looked closely at your class tree for Exceptions, but you seem to be doing this, at least somewhat. Make sure that the classes of exceptions that a method may throw is documented well (by classes I mean the parent/more general classes of Exceptions that a method may throw) throw new XML_Query2XML_SkipElementException(); This is an example of exceptions as control-flow. Don't do this. In the first case that I see you're throwing an exception and the catch just runs "break". This in particular is just silly. Just run break where you're throwing this Exception. I see another place where you simply continue on a "SkipElementException". Don't do that. See the Exception RFC for more: http://pear.php.net/pepr/pepr-proposal-show.php?id=132 Also see: http://wiki.ciaweb.net/yawiki/?area=PEAR_Dev&page=RfcExceptionUse Especially see in the above the ExceptionWrapping section. If you do choose to re-throw your own exceptions upon catching an exception you need to wrap the old exception in the new one. PEAR_Exception already supports this (pass the exception in as the second argument to the constructor). Your tutorial page is rendering a bit off in Firefox. The XML and SQL in your page is quished together (bad line height or margin I think). You generally don't need & in PHP5 (such as =&). PHP5 uses references for objects by default. Please use ' instead of " for strings wherever possible. http://pear.reversefold.com/strings/ Proposal information: http://pear.php.net/pepr/pepr-proposal-show.php?id=361 -- Sent by PEPr, the automatic proposal system at http://pear.php.net

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