Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

You missed one giant and important point. If you are familar with the style then its not more difficult to decipher.

$foo->bar(2) ->baz(3) ->qux;

Is no more difficult to read than:

my $bar = $foo->bar(2); $bar->baz(3); $bar->qux;

My point all along has been that it is only hard to read if you aren't used to the style. Map, grep and sort used to be nearly impossible for me to read because that wasn't a style I had encountered before. Now I understand and recognize those patterns. If I know that the mutators return the object in order to allow chaining then that code is easy to follow. If I don't know that then a quick check to the POD makes it clear in an instant.

The first requires a lot more effort to decipher than the 2nd.

That is only true for those who arn't used to it, or don't use it. It is not true for everyone, it is not an absolute that one is harder or easier to read. Like I said originaly, method chaining (mutators or otherwise) has always made perfect sense to me, maybe it's the way I think or experiences I've had. Either way, arguments that it's bad because it's hard to decipher, read, trace, etc, are all false because it is just a matter of the readers perception/experience.

Frankly, I' amused you think that's condescending because I think it's condescending to assume that because some people can't read it that it should be considered harmfull by everyone.


___________
Eric Hodges

In reply to Re^5: Mutator chaining considered harmful by eric256
in thread Mutator chaining considered harmful by Aristotle

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (7)
As of 2024-03-28 19:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found