Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

I'm of mixed feelings with vertical alignment of things on separate lines where the lines are indented to the same level. I often won't bother but sometimes do and even (sometimes reluctantly) admit that such can make the code easier to read, though I find that it can clearly be taken too far. For example, lining up punctuation just boggles me even though I've seen code like this:

my $i = 1 ; my $maxPercentDebit = 100.0+($i/100.0); $i = int ( $i ); $maxPercentDebit = normalizePercentage( $maxPercentDebit );

But I really hate lining up indentation of a line to match the length of code on a previous line. So I'll often rewrite code such as:

$maxPercentDebit = normalizePercentage( $i, $maxPercentDebit );

to something more like

$maxPercentDebit = normalizePercentage( $i, $maxPercentDebit );

(especially assuming a much longer list of arguments such that it doesn't make sense to group the arguments into a single line).

I even prefer to treat () more like {} and write:

$maxPercentDebit = normalizePercentage( $i, $maxPercentDebit, );

and in C where the extra trailing comma isn't tollerated, I'd really like to use:

maxPercentDebit = normalizePercentage( i , maxPercentDebit );

but hold no hope of getting any of my current cow orkers to see the beauty in that. (:

- tye        


In reply to Re^6: My coding guidelines (utopian) by tye
in thread My coding guidelines by Abigail-II

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-19 13:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found