Re: Reworking DOMXML

From: Date: Thu, 19 Jul 2001 13:30:28 +0000
Subject: Re: Reworking DOMXML
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-60294@lists.php.net to get a copy of this message
I prefer style #1 as well -- it preserves backward compatability and is consistent with the libxml2 docs. On Thursday 19 July 2001 07:44, Gavin Sherry wrote: > Hi Joey, > > Good to see some work going on with DOMXML =). > > On Wed, 18 Jul 2001, Joey Smith wrote: > > I think it is a good idea to keep both the "procedural" > > and "object oriented" interfaces in the code. > > This should be kept, at least up until a new major PHP release > occurs. > > > Style #1: > > The dom_document object is always the FIRST parameter to > > the function, if called as a procedure and NOT as a method > > on a dom_document object. > > > > Pro: > > This seems cleaner, as the user will ALWAYS know where > > the object belongs. > > > > Con: > > This might confuse the oop users, as the documentation does > > not currently clearly distinguish the two interfaces. > > I am in favour of this style. Two reasons: it is a loose convention > in development to have the first argument to a function/procedure > be the object/variable the function/procedure is primarily > concerned with. The second reason then stems from this: libxml > always takes the xml doc pointer as the first argument. A > difference between the two of them is bad form and could lead to > confusing code. > > > Style #2: > > The dom_document object is always LAST. > > > > Pros: > > Simplest to implement with code as it currently stands. > > Seems to be the way many other functions have been written. > > > > Cons: > > User will have to remember all arguments of all functions and > > pass SOMEthing, even if that means passing NULLs or something. > > Not necessarily. But in cases when you cannot easily identify which > argument is which except by position, this will run against the > conventional interfacing style of PHP. > > Gavin -- Paul Marquis pmarquis@pobox.com

« previous php.dev (#60294) next »