Re: Common method names part 2

From: Date: Thu, 19 Sep 2002 21:27:26 +0000
Subject: Re: Common method names part 2
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-9232@lists.php.net to get a copy of this message
<tuupola@appelsiini.net> wrote : > > There was an thread about common method names (maybe to be > included in CS) in PEAR classes. Method names such > as connect(), disconnect(), getXxx(), setXxx() were mentioned > then. > > What would be a good common name for "constructor" method. > I mean in the cases when this "constructor" returns instance > of itself _or_ an PEAR error. You could allways set $this > to PEAR_Error in the real constructor, but AFAIK this might > not work in the future. > > Is factory() considered suitable in this situation, since > it is interface for creating objects, _but_ is usually used in > situations where it returns instance of some concrete (driver) > class (suchs as DB_mysql or friends)? > > Other possibilities: init(), constructor(), ... I prefer init(). This allows for methods like initWithString(), initWithContainer()... Bertrand Mansion Mamasam

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