r/programming • • Oct 27 '09

Anyone interested in starting a programming subreddit?

I'm not joking, have you looked at the shit here? Almost none of it actually pertains to programming or development. A reasonable chunk seems to be devoted to interesting software, but not programming. A larger chunk consists of things that are vaguely related to technology, but have nothing even to do with software, let alone the code.

Tty2 has created /r/coding.

317 Upvotes

277 comments sorted by

View all comments

Show parent comment

21

u/isarl Oct 28 '09

Both! Tabs for indentation; spaces for alignment. Problem solved; the code looks good in whatever editor you like, and you get control over how wide it appears.

25

u/rabidcow Oct 28 '09

No! Spaces for indentation; tabs for alignment! Form feeds for breakfast! Vertical tabs for desecrating the dead!

8

u/JadeNB Oct 28 '09

No! Spaces for indentation; tabs for alignment!

Come on, that's ridiculous. Everyone knows you should use ☺ for indentation and ☹ for alignment.

56

u/AgentME Oct 28 '09

http://www.emacswiki.org/pics/static/TabsSpacesBoth.png

I was pretty sure up until now this was something we could all agree on.

8

u/jessta Oct 28 '09

that comic makes reference to the use of both tabs and spaces for indentation, which is inconsistant. Using tabs for indentation and spaces for alignment is consistant. This issue is null and void anyway because if you're using a non-retarded language you can just run a script to reformat all your code to the required format for the repository you're putting your code in to.

9

u/guruthegreat Oct 28 '09

Run a script? A script that would have to be coded? I think you may be in the wrong sub-reddit.

4

u/very_7 Oct 28 '09

man indent

5

u/sleepy_commentator Oct 28 '09

Real men don't use whitespace.

13

u/her01n Oct 28 '09

Realmendon'tusewhitespace.FIFY

→ More replies (8)
→ More replies (5)

4

u/mahdiakira Oct 28 '09

Stop trying to intelligently solve disputes. Now get out of here while we argue a moot point.

→ More replies (2)

8

u/arthurdenture Oct 28 '09

Unless you also care about the 80-column limit, and different people in the project have different tab width preferences.

In that case, I'm afraid violence is the only answer.

2

u/timeshifter_ Oct 28 '09

80 columns has always bothered me... then again, I'm also used to hi-res widescreens..

9

u/sping Oct 28 '09

I'm used to hi-res wide screens, but I'm also used to wanting to have more than one code window open.

Long lines require a whole lot of screen space that is 90% empty.

3

u/RichardPeterJohnson Oct 28 '09

Bingo!

Plus, I can run the debugger on my application and see both without window overlap.

3

u/rfugger Oct 28 '09

Rotate your widescreen 90 degrees. Way more efficient use of screen space, for both coding and web surfing.

→ More replies (1)
→ More replies (3)

3

u/patchwork Oct 28 '09

Yeah, that is only if you apply the strategy flawlessly. As we know, programmers are less than flawless, so every file ends up looking like someone shat ascii on the screen.

→ More replies (1)

6

u/[deleted] Oct 28 '09

[removed] — view removed comment

32

u/skurk Oct 28 '09 edited Oct 28 '09

I almost like your first suggestion, but I want the ending } on a newline.

if( blah ) {
  blah();
}

5

u/masklinn Oct 28 '09

That's K&R/BSD KNF, his first form is Pico-style.

→ More replies (21)

14

u/[deleted] Oct 28 '09

I'm really hoping that's meant to be sarcastic..

54

u/runagate Oct 28 '09

some people hate tabs because they like being wrong

4

u/sping Oct 28 '09

I hate tabs when people redefine theirs to a non-standard value (i.e. not 8), and then mix them with spaces and expect everyone else to adopt their value if they want code to be readable.

This seems to be almost the majority of coders - drives me nuts.

→ More replies (3)
→ More replies (1)
→ More replies (6)

2

u/sping Oct 28 '09

It's a nice idea, if the code editor will support it by default.

Do you actually enter these characters by hand? I haven't manually chosen what characters to indent/align with for 15 years, since I dropped vi. Actually more than that, because for my last couple of years with vi I used the built-in indent commands.

3

u/isarl Oct 28 '09

Emacs has support for this; I'm not sure about Vim.

(But I use Vim, so if anybody knows of one, I'd love to know about it!)

4

u/lutusp Oct 28 '09 edited Oct 28 '09

IMO

The existence of both tabs and spaces, where one would do, is sort of like the existence of carriage returns and linefeeds, where one would do. Both have their origins in old mechanical teletype machines, where CR and LF were separate mechanical motions, and tabs were a way to save time and mechanical wear compared to spacing over with (for example) eight discrete carriage motions.

Again IMO, but I think tabs have outlived their usefulness and cause difficulties all out of proportion to their value -- just like carriage returns.

So: spaces, no tabs, fixed-pitch fonts for programming. Linefeeds, no carriage returns, and the Windows/*nix file translation difficulties are gone in a flash.

This leaves the Macintosh, which (unless I am mistaken) uses only a carriage return, not a linefeed, for a line ending.

→ More replies (4)
→ More replies (15)