Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: To parens or not parens in chained method calls

by Your Mother (Archbishop)
on Feb 16, 2017 at 16:20 UTC ( [id://1182153]=note: print w/replies, xml ) Need Help??


in reply to Re: To parens or not parens in chained method calls
in thread To parens or not parens in chained method calls

Completely agree that consistency might be most important and that every dev is free to choose her own style (unless a house style is enforced, etc).

I argue that omitting parens, and breaking across lines into semantic chunks, does make the code more clear to a human reader; less content is less cognitive load. Athanasius's examples of the same operation in two styles shows this; where the single line idiom is, to a Perl-centric dev, much easier to read. There is less you have to load into your brain and fewer chances to read something wrong. I'm aware the longer version will likely be easier to follow for a non-Perl hacker. Just as a book written with 3rd grade vocabulary will be easier to the average reader or an ESL student. I gravitate away from the LCD because it ultimately saves time and raises my own game. It's more fun too. When I see an idiom in code that I don't know, I am generally more excited to learn it than I am irritated I don't understand it immediately.

  • Comment on Re^2: To parens or not parens in chained method calls

Replies are listed 'Best First'.
Re^3: To parens or not parens in chained method calls
by Anonymous Monk on Feb 16, 2017 at 18:46 UTC
    yet you don't write unit tests ... go figure

      I probably write too many unit tests. You have me confused with someone else; which is pretty hard to do since I frequently answer testing related questions here.

        That's one thing we definitely have in common. I'm not happy until I have 100% coverage, in numerous different ways, and often go way overboard.

        Test envy? XD

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (8)
As of 2024-04-19 15:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found