Re: db abstraction: pass by reference versus return
| From: | Martin Jansen | Date: | Thu, 11 Jul 2002 15:53:21 +0000 |
| Subject: | Re: db abstraction: pass by reference versus return | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-7664@lists.php.net to get a copy of this message | ||
On Thu Jul 11, 2002 at 04:1630PM +0200, Lukas Smith wrote:
> 1) The question is about if methods should always either return DB_OK or
> an error object and any return data should be placed into a var that is
> passed by reference.
>
> 2) Alternatively the method can either return the data or an error
> object. ("the PEAR DB way").
For the records: That's my favourite way and I'm for sticking to
it. The reasons for this are described below.
> 3) Finally we can have a mix. If this is the option then we need to
> decide what methods should work which way ("the Metabase way").
Mixing both ways will create inconsistency in the package, which
generally is a bad thing.
> I think this is a major useability question so I just wanted to ensure
> that this is done the way people really want it to be.
>
> Somehow 1) seems like the comp sci way of doing things as it just feels
> cleaner to me. :-)
Yeah, may be, but IMHO 2) is just more intuitive, since people are
used to work this way: Nearly all PEAR packages work this way right
now. Using 1) in MDB/DB will cause a bit of inconsistency then because
we'll have 99% of the PEAR packages using 2) and just 1% using 1).
- Martin
--
Martin Jansen - mail@martin-jansen.de
http://martinjansen.com/