Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Clever vs. Readable

by Perlbotics (Archbishop)
on Aug 09, 2008 at 22:40 UTC ( [id://703338]=note: print w/replies, xml ) Need Help??


in reply to Clever vs. Readable

Considering the poor maintainer (probably oneself), I would vote for readability most of the time. However, shorter code sometimes executes faster (the OPs example probably not). E.g., I think of something with implicit loops like map{...} which gave me some problems decoding when I was a Perl beginner. If terse code is a must, proper commenting is 'more' mandatory. Consider this:
$result = ($a, $b)[$b <= $a];  # minimum ($a, $b)
Less than 20 additional characters read in a fraction of a second helps to save some dozens seconds decoding and the uncomfortable feeling to have something missed. From my point of view, clever is okay when there is a gain, be it speed of execution or degree of obfuscation.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (4)
As of 2024-04-23 23:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found