Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
"Are there items that make you feel more comfortable with the code?"

There are things that definitely make me feel more uncomfortable. For example, cramming a dozen functions onto one line in some kind of clever but completely unreadable tangled chain. Of this sort:

@_ = join "\n", map {/$complicated_regex/} split '', join ',', reverse sort map {lc} map {do_backflips($_)} keys %{ $var->{$something} };

On the same token, massive amounts of referencing and dereferencing:

$data_ref = [ @{ @{ $ref->{ $sub->(\%hash, {key=>[@_[0..4]]}) }}[0] }[1..3] ];

I don't even know if that line is valid Perl, but I've seen that kind of thing given as a response here at PM sometimes. It might save you from allocating variables to store temporary references, and maybe you'll save 12 bytes of RAM and 15 nanoseconds of compute time, but I don't think it's worth the pain it causes my brain to try to parse it.

Isn't there some kind of natural limit to the amount of things a person can hold in short-term memory? One-liners are clever and fun, but probably don't belong in code that anyone else ever needs to read.

"Do you feel you can rate the experience level of the author by how the code looks, both in Perl and programming in general?"

When code is written with heavy use of Perl idioms, I tend to think the person is more experienced.

I agree with pg that this isn't always a good thing. Unless you're the only person who needs to read your code, it's not too useful to be really good at speaking a language no one else can understand. Some idioms, like $data = do {local $/; <FILE> }; or something, are useful and straightforward and simple enough that one could reasonably expect a "Perl programmer" to know what it means. More complex or obscure or inventive idioms are probably not a good thing (unless you can convince everyone else to use them. How's that for some logic. :) ).

"Has your style changed as you have improved as a programmer, both in Perl and in general? If so, how?"

The better I get at programming, the less work I (need to) do. I use more and more of the CPAN to do the dirty work for example. Or learn to take something I wrote and stick it somewhere I can reuse it. And learning to write clean code means I'm less likely to have to fix something or re-write something in the future.

I also find my code being longer, in the sense that I write more verbose code for the sake of making it easier to read and edit later. This is a good kind of longer. More typing in the short-term, less work in the long-term.

Lots of other things. There are so many ways to do things (especially in Perl) that you can't help but change the way you write code over time.

"Do you think that the style of a piece of code can contribute to its maintainability?"
Style is pretty much all that contributes to something's maintainability.

In reply to Re: Commonly accepted style guide? by chester
in thread Commonly accepted style guide? by dragonchild

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

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

    How do I use this? | Other CB clients
    Other Users?
    Others imbibing at the Monastery: (10)
    As of 2014-08-23 11:45 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      The best computer themed movie is:











      Results (173 votes), past polls