Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^6: My coding guidelines (utopian)

by tye (Sage)
on Apr 13, 2004 at 16:35 UTC ( [id://344789]=note: print w/replies, xml ) Need Help??


in reply to Re: Re^4: My coding guidelines (utopian)
in thread My coding guidelines

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        

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://344789]
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-03-19 05:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found