[MTOS-dev] More sophisticated interface of MT::Template::Node
Brad Choate
brad at sixapart.com
Sat Mar 1 12:35:19 PST 2008
More readable, yes. But there are a LOT more subroutine calls going
on, and I worry about the overhead due to that. Some benchmarking is
in order.
-Brad
On Mar 1, 2008, at 12:12 PM, Jay Allen wrote:
> On Sat, Mar 1, 2008 at 11:11 AM, Hirotaka Ogawa
> <hirotaka.ogawa at gmail.com> wrote:
>>
>> Because MT::Template::Node has neither a constructor nor sufficient
>> accessors, we need to specify which references are weak, at every
>> constructions of NODE object and every updates of weak-referenced
>> fields of NODE. It is also not good, as for readability and
>> maintainability. Who knows $node->[2]->[0]->[2]->[0] means the first
>> child of the first child of $node?
>
> Hi Ogawa-san,
>
> I haven't tested your patch, but I read over it briefly. I think this
> is a fantastic change for a number of reasons but outside of the
> obvious one related to proper OO and weak references, the most
> striking one is that it's INFINITELY MORE READABLE.
>
> Without any documentation, Su and I were trying to read the code with
> all of those array references to try to figure out how the data
> flowed. Your patch dispenses with the need for most of these which is
> great.
>
> If there's anything that I would like to see changed it would be to
> stop using an array and start using a hash reference for arguments.
> That is, instead of:
>
> return NODE->new('TEXT', undef, undef, $text, undef, undef, $tmpl);
>
> we do:
>
> return NODE->new({type => 'TEXT', blah => $text, tmpl => $tmpl});
>
> Jay
>
--
Brad Choate
Engineering Manager, Movable Type, Six Apart, Ltd.
http://www.sixapart.com/movabletype/
Mobile: (918) 271-0105 - AIM: bschoate
More information about the MTOS-dev
mailing list