Reminder that if you don't use 2 spaces for indentation, you're a terrible programmer

Reminder that if you don't use 2 spaces for indentation, you're a terrible programmer.

Other urls found in this thread:

lea.verou.me/2012/01/why-tabs-are-clearly-superior/
myredditvideos.com/
twitter.com/AnonBabble

html programmer
top kek

tabs for indentation, spaces for formatting
people used spaces instead of tabs because tabs being rendered differently in different editors was an actual issue with small screens and tight consoles
this is now pointless, and tabs yield the advantage that everybody with a decent editor can set up the width in a way that's the most readable to them

I use tabs that correspond to 4 spaces.
In very specific situations I'll use two spaces.
I once did a project for a boss that I hated with 8 spaces for indentation.

I use 3 spaces.

If you're gonna use spaces at least use 4 spaces
2 spaces is literally unreadable garbage and the only reason I quit my older job even though it was better paying (team adopted 2 spaces for everything)

a lot of languages use spaces as part of syntax, mixing tabs and spaces fucks up these languages, tabs should be auto-replaced with spaces automatically in every git commit

Or you could just use python where the makers took the whole tabs vs spaces argument way too seriously.

sure, if a style guide dictates otherwise you should obviously use spaces for everything instead

>programming


>indentation


>not using white spaces


kek

Spaces are better than tabs no doubt, because tabs arent the same width on all platforms, so if you mix tabs and spaces (which if you write enough code is bound to happen) it will look fucked up on other platforms. But 4 spaces > 2 spaces.

>im totally a badass gonna fuck his shit up
>search 8 spaces
>replace with a tab.

tab is defined as 8 whitespace characters

Consistent indentation is far more important.

A real decent editor can do the same with spaces.

editors should always be configured "tabs to spaces" when saving

No, tabs are defined as as many spaces as needed to make the column a multiple of 8.

They're used for making TABles, not for indentation.

Two tabs have the same width as 4 spaces, tab, 4 spaces, tab.

Choice of tabs vs spaces depends on language and project style guides. For C and C++, which tend to not have a single standard going, I prefer smart tabs. Hard tab character for identation, spaces for alignment. Width of the tab character does not affect alignment when smart tabbing is done properly.

>a lot of languages
Not really. Python, CoffeeScript, F#, and I think Haskell have semantic whitespace, but unless you're programming in one of these languages, you don't really need to do this.

It is perfectly acceptable to mix tabs and spaces if and only if you do so without making an assumption about the width of a tab character. See smart tabbing.

Wrongo

two languages Im using are Go and Elixir which also force spaces as part of the syntax, its becoming more popular in modern languages. Allowing tabs might be ok in languages like C++, Java, C#,etc but youre not going to be allowed to commit to lots of projects using modern languages if you use tabs

i can only use tabs in coffeescript so copy and pasting code with spaces fucks everything up.

>without making an assumption about the width of a tab character
That's good, because tab characters don't have width. They're a control character that tells the terminal to move the cursor to some arbitrary column on the screen.

it gets a lot more complex when spaces are also used for formatting, though

go does not force spaces as part of the syntax

yes it does, you have to have a certain distance between keywords and parens, and other stuff like that

>so if you mix tabs and spaces (which if you write enough code is bound to happen)
You mean if you copy and paste enough code it is bound to happen.

If you have a decent editor, you probably can't even tell if you are using tabs or spaces.

It doesn't matter at all.

I use tabs because most C programs are written using tabs

>It doesn't matter at all.
Spoken like someone who has never used python.

>editing a python script
>new line
>editor puts in tabs instead of spaces
>looks the same
>ERROR IMPROPER INDENTATION

>In today's news: Discussion about things that don't matter continue with no end in sight.

have tab mapped to two spaces

best way

okay that's python

go recommends that you use tabs

tabs vs. spaces doesn't matter if you are not using an authoritarian language

you deflected the argument into a python vs. other language debate

I bet you use emacs

What I do:
Tabs for indentation, spaces for alignment. Visually two spaces.

What I'd like to do:
Non-fixed width font + elastic tabstops.

I see what you are trying to do but I won't take the bait. I shall endure.

fpbp

this

>not just setting expandtab

I use whatever settings my IDE has. Best combined with auto format on save.

I use 4 spaces.
Also scripting with a markup language doesn't make you a programmer, so I guess even "terrible programmers" have you beat.
Also depending on your IDE you should be able to quickly switch between which ever style you want to.

Using certain spaces between keywords and parens is not the same as using spaces for indentation. I think you'll find that Go actually recommends (and I believe enforces?) tabs for indentation.

>IDE
>2016

oh brother...

fuck off and try actually writing code.
I get sick of spaces from other peoples code because they all choose a different number.
Tabs are a thing to fix this problem. Set your tab width and *blam* it is correct for your style.

Fuck sake, its tabs>spaces. If you need to use spaces, use tabs and format it later with sublime. less clicks, automatically turns spaces to tabs. only retards and autists still think about this. stop this sad meme.

This.

>not using 8 width tabs

Stay pleb.

Swings and roundabouts, every elite programmer has their own preference. As long as you use sufficient notes throughout your code, you're miles ahead of most other men!

Sent from my iPhone using TapaTalk

guro content

Always tab, then use space to align it

>HTML
1/10 bait

not true on all systems

you quit a job because of the number of spaces used for indentation? that's some next level autism

>download someone's code
>they used spaces
>mfw I have to mash backspace 20 times to change a single line

Or just do it yourself, it's less than 20 lines of code to replace tabs by spaces in a file.

/thread in the 2nd answer.. good job Cred Forums

shift+home ?

Four spaces, never use tabs as they annoy me.

>using 2 characters instead of 1
>wasting precious bytes

This

> (OP)
>Spaces are better than tabs no doubt, because tabs arent the same width on all platforms, so if you mix tabs and spaces (which if you write enough code is bound to happen) it will look fucked up on other platforms.
Its not a problem if you use only tabs.
Mixing both is fucking retarded

Tabs for indentation spaces for aligning master race here.
I'm not a child, I don't need an IDE to replace tabs with spaces for me just like mommy doesn't feed me anymore.

SHIT TIER LANGUAGES
Can't they just be like normal and be independent about whitespace at all?

>aligning
Only code monkeys do that.

Modal editor (Vim): dd
Since you said change: 0C
If you wanted to keep indentation: _C

Use a real text editor.

>not using π spaces

>not using ξ spaces

BOTH

>spending months just to learn to use text editor

Tabs at home, prefer spaces in work, reason is that it seems like the majority of devs don't understand the tab for indentation, space for alignment rule. Gets tiring rejecting changes due to messed up code formatting involving shit use of tabs.

Also, deleting your trailing whitespace you pleb.

>not using λπ/2 spaces

lea.verou.me/2012/01/why-tabs-are-clearly-superior/

I use the default tab size from MS Word

>use spaces
>give code to someone else
>mayhem starts when they try to use tab
fuck off pajeet

How about following the style guide for each language you autists?

>not using ^\s+

Sublime fag btfo

Reminder the efficiency of your program and its documentation are ahat make you a good programmer. But you know all about that dont you html boy?

You have a mouse, use it.

Map tab to 1 space. Best of both worlds.

Google uses two spaces

language default