[development] Drupal - to use objects or arrays

Khalid B kb at 2bits.com
Wed Jan 10 06:05:10 UTC 2007


I think Doug is taking about PHP objects, not objects as they are used in
core Drupal.

By PHP objects, I mean created using "new", having inheritance, methods, and
the whole nine yards as defined by OOP.

Drupal objects are things like the $user, $node, and the objects from
db_fetch_object() calls.
Those are not real classes cannot be inherited from, have no methods,
...etc. (Well, $node is
an object, but can it be inherited from? Can it have methods?)

So, when Larry says we had this discussion before, he is referring to the
latter (and if I recall
correctly, more specifically the database objects). And yes, we did not
reach consensus on that.
(Can someone link to the mailing list discussion on that).

I personally find that it is easier to say $foo->$bar['baz'] rather than
$foo['bar']['bar]'.

But I think Doug is talking about the real objects as used in some modules
that are OOP.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20070110/6dc49c07/attachment.htm 


More information about the development mailing list