Re: More than one values returned?
| From: | Nick Stinemates | Date: | Wed, 20 Feb 2008 05:51:20 +0000 |
| Subject: | Re: More than one values returned? | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-269692@lists.php.net to get a copy of this message | ||
Robert Cummings wrote:
> On Tue, 2008-02-19 at 21:24 -0800, Nick Stinemates wrote:
>
>> I said, simply, returning an array of objects was usually an indication
>> of poor design.
>>
>
> Please elaborate as to the "why" of it being an indication of poor
> design.
>
> Cheers,
> Rob.
>
I already did...
I can condense it, since apparently I wasn't diligent enough in my
explanation the first time. I have a feeling that this will probably
evolve in to Procedural vs. OO design flame war, which was not the
intent nor desire.
Please also consider that I am talking about modular/extensible design
philosophies (Gang of Four) strongly used in languages like C++/Java.
Normally, if you're going to be returning a group of objects from a
method you're going to want to do something with them. In this case, why
should I expect the client of my library to have to do bulk operations?
The less trivial the example the more important it becomes, _especially_
if your method is used more than once! That's twice the amount of code.
If that doesn't make sense then my reasoning must be shit.
--
==================
Nick Stinemates (nick@stinemates.org)
http://nick.stinemates.org
AIM: Nick Stinemates
MSN: nickstinemates@hotmail.com
Yahoo: nickstinemates@yahoo.com
==================