Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
> Moreover, I'm a huge fan of Skimmable code

unfortunately is this link only showing the talk abstract, but no further details.

From what you describe, this is very close to the recommendations of Damian's PBP, especially:

> I often use "paragraphs" inside subroutines

IIRC, this is called "chunks" there, though I tend to start them with one full line comment

You didn't mention it explicitly, but avoiding too many nesting levels is one of general best practices.

They are a clear indication for more smaller subroutines.

for instance a contrived example following the input/process/output scheme

#--- calculate debts per client my %result; for my $client (@clients) { #--- get data my %details = fetch_details_from_DB($client); ... ... ... #--- process data my $debt = calculate_debts(%details); ... ... ... #--- store result $result{$client} = $debt; ... ... ... }

I like to read such a loop inside a full page ( at most 100 lines), even prefer to have a sub inside such a window. (I hate guessing in which function/loop I'm currently being, {update: I want to see the declared private variables too})

So if the chunks consist of more than a handful of lines, I try to refactor them into a bunch of dedicated subs.

With meaningful "self-documenting" naming I can even avoid the then redundant #--- documentation line.

Hope I'm grasping your idea, and would love to hear where Schwern's recommendations are differing from Damian's.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

UPDATE

for very strange reasons I'm getting my own code displayed with doubled line distance. I hope it's only me, logging out shows them correctly.

update

Changed the css settings to line-height: 10px , no idea when this changed.


In reply to Re^2: Section Dividers - What are your thoughts by LanX
in thread Section Dividers - What are your thoughts by johnfl68

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!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            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 lurking in the Monastery: (8)
    As of 2020-12-04 23:27 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      How often do you use taint mode?





      Results (63 votes). Check out past polls.

      Notices?