Login | Register
My pages Projects Community openCollabNet

Reply to message

2020-03-13: This site is going to be decommissioned and shut down very soon. Please copy and archive any data you wish to keep ASAP

* = Required fields
* Subject
* Body
Send reply to
Author (directly in email)
Please type the letters in the image above.

Original message

Author =?ISO-8859-1?Q?David_Z=FClke?= <dz@bitxtender.com>
Full name =?ISO-8859-1?Q?David_Z=FClke?= <dz@bitxtender.com>
Date 2006-10-04 08:31:18 PDT
Message I agree with this. The fact that we'll be using iterators will
(hopefully) eliminate any memory issues, since the objects are
returned on the fly and not stored anywhere first.


Am 04.10.2006 um 17:25 schrieb Alan Pinstein:

>> Why get an instance of each object?
> Why? Because re-using objects is:
> 1. BAD OO design... one instance == 1 LOGICAL instance. If you re-
> use it, you are pretty much breaking black-box. "Clients" of your
> objects don't expect this behavior, because it's bad OO design.
> What if in the course of using FETCH_INTO, you have some
> relationships:
> foreach (FETCH_INTO loop) {
> $myObj->setRelat​edObject($Y);
> }
> Well this is going to end up an awful mess, with no referential
> integrity in your object model.
> 2. There is no meaningful benefit to FETCH_INTO. Seriously, name
> one potential benefit of doing this. Are you thinking performance?
> Lots of things in OO would be faster if you break the OO... but it
> shouldn't be done.
> 3. With your example:
>> Now, i wanna publish a List of Person with their fullnames. I
>> don`t want to
>> change data or something -> just want to print table containting the
>> fullname and some columns additional information. I`ll implement a
>> method
>> getFullname in my Object-Class:
> Ok great! That's a completely reasonable thing to want to do.
> HOWEVER, I don't see why getting back DISTINCT instances for each
> iteration prevents this from happening. It doesn't use more memory
> and it isn't much slower (only real speed difference is calling the
> constructor).
> However, I can promise you that getting back the SAME instance each
> time, but it having different data for *some* columns, will
> definitely cause you hours of painful debugging, followed by "Why
> am I using FETCH_INTO"?
> ---------
> Just b/c PHP does something, doesn't mean that it's a good idea, or
> that every project using it should "wrap" that functionality.
> I'd be happy to continue this conversation, IFF you can provide an
> example of something that FETCH_INTO provides that you can't
> otherwise do.
> Alan
> --------------------​--------------------​--------------------​---------
> To unsubscribe, e-mail: dev-unsubscribe@prop​el.tigris.org
> For additional commands, e-mail: dev-help at propel dot tigris dot org