Re: More than one values returned?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2008-02-19 at 21:51 -0800, Nick Stinemates wrote:
> 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.

It makes sense in the sense that you anticipate certain bulk operations
being performed. But as soon as you don't, they must resort to bulk
operations again. Also, your assuming I want your group object to apply
these bulk operations. Why can't I just request the result set, create
an operations object, and pass the operations object your group object?
Why must the action be on the group object. Going a step further, if
I've moved the action to an action object, why do I need a grouping
object? It can work as well on arrays or objects. As such I'll skip the
overhead of a group object since an array is perfectly sufficient and
Ill pass it to my operations class.

More than one way to skin a cat. My operations class knows how to deal
with lists, binary trees, vectors, arrays, CSVs, Xcel files. These are
just extended classes on top of the operations object. And unlike your
group object, my operations object can deal with any datatype, not just
objects.

No, I don't really have this class, but I could.

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux