Steve Dondley wrote:
Think of all the little php snippets, custom blocks, *.tpl.php, etc. files that use object notation instead of arrays. I actually wouldn't mind the work on the sites I'm responsible for if it meant putting an end to that sick little game I play everyday where I ask, "do I get to you through $foo->bar, $foo['bar'], or are you a very special $foo[0]->bar? and are you the same if I'm dealing with you in hook.module, a template.php, or a node.tpl.php?" ['the answer is often no']. The inconsistency has a tendency to be very annoying, imho. Not to mention... the methods used in about 60% of the snippets in the handbook make the hair on the back of my neck stand up... forcing a rewrite of some of them might not be a totally bad thing.
Can anyone here give an explanation of the status quo"an object here, an array there, and an intelligible pattern nowhere" that goes beyond, "well... that's just how its always been, and some things are now dependent on it, and its going to be a pain the ass to change it..."? Maybe I'm alone here, but I think that moving to make drupal's code more logical, consistent and predictable is a critical priority -- as high as usability, sexiness, ajaxitiviy,etc etc. Regardless of there being no immediate benefits on the feature/performance level, we should consider the value of having a platform that new developers describe as "friendly, and intuitive". Best, Nick Lewis "captain obvious" http://www.nicklewis.org
All of them will be useless. Converting them all over will cause a lot of people a lot of pain and frustration.
Switching would not be worth it and a big mistake, IMHO.
On 7/2/06, Gordon Heydon <gordon@heydon.com.au> wrote:
Hi,
I'm down on consistencies sake. I'm also into the flexability of
arrays.
Our occasional use of objects don't allow us to do anything useful with them. Where we do have objects, they don't have any methods. So whats the point of keeping them around?
There are a couple of reasons why we do not change.
1. Objects are easier to work with than arrays, but then again, it is 6 of 1, half a dozen of the other.
2. What is changing going to get us? We would spend the next 6 months moving all the code so that we use arrays over objects, and we will be no further ahead. There is no gain or loss.
3. I remember reading somewhere long ago. Dries likes them over arrays.
This is like saying nodes are crap, and we should change them to the next greatest XYZ.
Gordon.