Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: No Hard Tabs in Code

by ssandv (Hermit)
on Jul 01, 2010 at 15:53 UTC ( [id://847538]=note: print w/replies, xml ) Need Help??


in reply to No Hard Tabs in Code

Use spaces because everything else is worse unless used with extreme caution, not because spaces are awesome. Perfectly tab-formatted code, in an environment where you know the tab stops will be the same for everyone, is probably the best case--but the instant someone grabs a code snippet and tosses it in an email message (5-space tabs...the horror!) or changes their settings, all that effort to line things up is not only for naught, it's actively harmful to reading the code.

It's not that spaces are better, it's that they're least awful when awfulness happens (and it will.) Other people have to read your code, if you're at all serious about programming, and it's not excusable, nor effective to demand they conform to your tab stops. So don't use them.

Replies are listed 'Best First'.
Re^2: No Hard Tabs in Code
by Tux (Canon) on Jul 01, 2010 at 16:09 UTC

    Someone setting a (e-mail) tab to 5 spaces is asking for horror. They deserve horror.

    IMHO anyone setting a TAB to something other than 8 spaces should not send patches or be able to commit to a central repo.

    I have no strong feelings for tab vs spaces. As long as they are used consistently within the team (teams are huge for open source projects), it is fine with me.

    I much more care about indentation. Specifically with people that use cut-n-paste from other files and do not adjust it for the current file. Oh horror!


    Enjoy, Have FUN! H.Merijn

      8 spaces is a ridiculous waste of real estate, to me. It's far too much for a single layer of indentation, and I find it _harder and slower to read_.

      On the other hand, if you mandate tabs, and tab stops are smaller than the most extreme person prefers them to be, you get the ultimate disaster of mixed tabs and spaces--which is yet another good reason to turn everything into spaces.

      A 5-space first tab, for paragraph indentation, was the standard for fixed width text for a very long time until not all that long ago. How quickly we forget.

        [...] In short, 8-char indents make things easier to read, and have the added benefit of warning you when you're nesting your functions too deep. [...]

        Taken from Linux documentation (Doc*/CodingStyle) Chapter 1.

        I think this explains very well the idea behind the 8-chars tabs "movement".

        There are heretic movements that try to make indentations 4 (or even 2!) characters deep, and that is akin to trying to define the value of PI to be 3.

        (The second quotation was just for fun :D)

        Alex's Log - http://alexlog.co.cc

Log In?
Username:
Password:

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

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

    No recent polls found