[drupal-devel] Why the object notation?

Bèr Kessels berdrupal at tiscali.be
Thu Jul 28 08:28:01 UTC 2005


I like what we have now:
An array when it is a recurring 'thing'. An object when that thing is a single 
wel... 'object'. 

You don't want to iterated through all fields of a user, for they have all 
different kinds of functions. Hence it is an object. But a list of terms 
associated with a node comes as an array. Because you will most likely want 
to iterate over it and perform the same action to each entry.

So, bottomline: A -1 on making it all one thing.

Op donderdag 28 juli 2005 09:22, schreef vlado:
> On Thu, 2005-07-28 at 07:58 +0200, Gerhard Killesreiter wrote:
> > On Thu, 28 Jul 2005, Karoly Negyesi wrote:
> > > > (-> is two keystrokes for me, [''] is eight)
> > >
> > > Gerhard, it's true that -> is less keystrokes than [' '] but there is a
> > > problem -- since when do we treasure more developer time than running
> > > time?
> >
> > Prove to me that execution time is greatly improved by using [''] and I
> > will change my opinion. :o)
>
> Object to array converisons take time.
>
> Otherwise there shouldn't be too much difference, since methods and
> member variables are stored in associative arrays.
>
> There is another case, apart from speed, though. Looping through hashes
> is immediate and more convenient than using objects.
>
> Vlado
Regards,
 Bèr
-- 
 [ Bèr Kessels | Drupal services www.webschuur.com ]



More information about the drupal-devel mailing list