[drupal-devel] Why the object notation?

vlado vlado at dikini.net
Thu Jul 28 09:41:19 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.
I'm fine with this logic. We should probably put an explicit explanation somewhere in the 
docs, for example in the coding style guidelines. I think there is a tendency
to use objects vs arrays for estetic reasons only, which makes no real
sense IMO.

Vlado




More information about the drupal-devel mailing list