Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: My Perl code can be understood by...

by Juerd (Abbot)
on Feb 25, 2008 at 15:27 UTC ( #670028=note: print w/ replies, xml ) Need Help??


in reply to My Perl code can be understood by...

It all depends on the kind of code, and the intended audience. For CPAN modules, I try to optimize for performance if it doesn't hurt readability too much. This code can be understood by experienced Perl programmers.

For one-off quick hacks and oneliners, I don't care about readability and will use any technique that saves me from having to write much more code. This code can often be understood by people who are experienced in Perl. I will use ~~ instead of scalar.

For example code in documentation, I try to optimize for readability. However, I will continue to assume that the reader is at least comfortable with Perl. That means that I still do use statement modifiers and the $_ variable.

The Perl novice will have to find a way to plough through the first part of learning Perl: dealing with its sometimes exotic syntax. In some ways that is a barrier of entry, and keeps dumb and uninterested people away. It's not hard to learn how Perl works, there's lot of documentation to explain it. If you're learning Perl, you're only a real novice for a few days anyway.

I suggest that people who are not comfortable with Perl, should not be using it.

Juerd # { site => 'juerd.nl', do_not_use => 'spamtrap', perl6_server => 'feather' }


Comment on Re: My Perl code can be understood by...
Re^2: My Perl code can be understood by...
by gloryhack (Deacon) on Feb 26, 2008 at 01:08 UTC
    ++ ** 10E6!

    I spent years dumbing down my code so J. Random Neophyte could read it, understand it, and make changes. I found out the hard way that JR is an untrustworthy witless dolt who should never be allowed to use a computer. He turns off the strict pragma because it does nothing except stop perfectly valid code from executing, and thinks that testing is a crutch used by incompetent programmers who don't know what to expect from their own code. I don't want JR to feel comfortable "fixing" my "executable line noise". I want JR to go back to flipping hamburgers where he belongs. And to receive at least two painful burns each week. On his face.

    The greatest threat to continued habitability of the planet is people who are convinced of their knowledge of things they've never actually learned.

      Now I have to go and find the 20 things most likely overheard from a Klingon programmer ... Sheesh! http://gradha.sdf-eu.org/textos/klingon_programmer.en.html

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (9)
As of 2014-07-24 08:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (158 votes), past polls