On Tue, 16 Sep 2003, David Cantrell wrote:

> On Tue, Sep 16, 2003 at 02:44:25PM +0100, Shevek wrote:
> 
> > This whole chained accessors thing is a definite perl-ism and will do you 
> > no favours with people for whom Perl is not a primary language.
> 
> I see similar method chaining in Java.
> 
> poing = foo.convert_to_bar().do_stuff_to_object().convert_to_string();

In this case, I don't see that foo.convert_to_bar() is returning foo. I 
don't claim that method chaining is wrong. I claim that method chaining 
when equivalent to foo.a(); foo.b(); is unpleasant and unnecessary.

David Cantrell attempted to pronounce:

> return 0->reason(ERR_BAD_PARAM)->details('foo')

Case in point. This is an ugly neo-perlism. I like the freedom of Perl,
but this kind of thing does it no favours. It increases effort for the
maintainer, but makes no immediate saving whatsoever. It's syntax for the
purpose of syntax. It's in violation of the KISS rule.

I tell my students that one of the important things when writing code is
to write the code that your maintainer expects to see unless you have a 
very good reason for doing otherwise. This reduces maintenance costs.

S.

-- 
Shevek                                    http://www.anarres.org/
I am the Borg.                         http://www.gothnicity.org/

Reply via email to