[drupal-devel] Why the object notation?

Adrian Rossouw adrian at bryght.com
Fri Jul 29 04:58:03 UTC 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

i far prefer array's vs objects since you can much more simply step  
through the elements.

I also like the definition of arrays over objects (think of the menu  
arrays, and pretty soon the form arrays.)


On 28 Jul 2005, at 2:41 AM, vlado wrote:

>> 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
>
>

- --
Adrian Rossouw
Drupal developer and Bryght Guy
http://drupal.org | http://bryght.com


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)

iD8DBQFC6bdNgegMqdGlkasRAgt1AJ9lSmF4yvmZlwz4PCAEzLLVfc/ShACfXgw1
nl1H3NY/tc5Qo/hK2yZoVUg=
=geEV
-----END PGP SIGNATURE-----



More information about the drupal-devel mailing list