Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: The One True Style of indentation:

by FoxtrotUniform (Prior)
on Apr 15, 2002 at 17:39 UTC ( #159279=note: print w/ replies, xml ) Need Help??


in reply to The One True Style of indentation:

I code to a rather strict interpretation of K&R style, but I use two-column indents instead of eight- columns, mostly to conserve screen real estate. (And of course I cuddle my elses!)

    Update: Cuddled elses are:
    if(foo) { ... } else { ... }
    whereas perlstyle, IIRC, recommends:
    if(foo) { ... } else { ... }

Another thing: I try to keep my line lengths below 72 columns. This keeps it easy to read even when you're editing it on the server console (don't ask), with vi in line-numbering mode. (And if a line's longer than 72 columns, it's probably malformed anyway.)

I used to be vehemently anti-1TBS, citing all the usual arguments about braces getting lost and code being cluttered and hard to read. Then I took a course from a prof who used 1TBS all the time, and it just clicked. (Sort of like the way I started out using Emacs, and switched to vi.)

--
Good luck, tilly
:wq


Comment on Re: The One True Style of indentation:
Select or Download Code
Re: (FoxUni) Re: The One True Style of indentation:
by snafu (Chaplain) on Apr 15, 2002 at 19:25 UTC
    Yes. Screen real estate is very important to me too. I love the concatenation operater for this purpose.

    I could get use to 1-TBS but I don't want to :) This is the beautiful thing about coding is that its very personal and distinct. Its like literature. No two people code the same nor do any two people write literature the same.

    Holy (programming) wars are fun to argue about but they are really useless. Btw, cuddled elses...are they the

    condition () { more code }

    or

    condition () { more code }
    I like the second but I admit that the first is growing on me. This is a topic in-and-of-itself for a holy war. :) I think I see the next vote topic! =P jk

    _ _ _ _ _ _ _ _ _ _
    - Jim
    Insert clever comment here...

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (7)
As of 2014-10-02 01:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    What is your favourite meta-syntactic variable name?














    Results (41 votes), past polls