Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Unlimited chaining (is there a way to detect this?)

by weierophinney (Pilgrim)
on Jan 06, 2008 at 20:11 UTC ( #660686=note: print w/replies, xml ) Need Help??


in reply to Unlimited chaining (is there a way to detect this?)

Martin Fowler calls this a "fluent interface": http://martinfowler.com/bliki/FluentInterface.html

The idea behind it is that methods that are simply setting object state return the object instance; this can improve readability in many instances, particularly if you align the '->' pointers vertically, and can be used to build constructs that have a natural linguistic flow -- hardly 'dumb' code.

As for detecting it... simply don't write such constructs; the only way you'd be able to programmatically generate such a construct is to pass it to eval, and eval is rarely the right answer.
  • Comment on Re: Unlimited chaining (is there a way to detect this?)

Replies are listed 'Best First'.
Re^2: Unlimited chaining (is there a way to detect this?)
by Burak (Chaplain) on Jan 06, 2008 at 20:56 UTC
    Interesting... I didn't hear that "fluent interface" before :)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://660686]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2020-12-05 00:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How often do you use taint mode?





    Results (63 votes). Check out past polls.

    Notices?