Skip to content
Heroku is a container-based cloud Platform as a Service (PaaS). Developers use Heroku to deploy, manage, and scale modern apps. Our platform is elegant, flexible, and easy to use, offering developers the simplest path to getting their apps to market.
markdown guide

I haven't seen the argument of accessibility tossed around here yet. I saw it a while back and it's stuck with me. Tabs have configurable width, spaces do not. If some people need deeper tabs, they can't do that with spaces.

Personally, I use spaces. I think that's because a lot of people use spaces. I'm not opposed to using tabs (they might even be more convenient for deletion using backspace/delete key).


Having both isn't necessary. We only need one. In my opinion, if we had to get remove one, it would be tabs. Spaces can't be removed so they stay. It reminds me of null and undefined in JavaScript. Two different things to do one job. It's unnecessary and can lead to bugs. Best to only have one. That's what I think 🙃


I like that you only will accept total victory: in the war of spaces versus tabs, tabs must be completely annihilated


Let's not "decide"! Use what works for your project. One project needs tabs; another needs spaces. It depends on the project goals, the development tools, and the team's needs. To make a declaration that one is objectively and unilaterally better than the other is to assume one knows all the possible projects that could ever exist.


We can not forget that Makefiles need tabs! I use spaces everywhere but I need to have my editor configured to use tabs when I am editing a Makefile.

I use both and that's the reason. Honestly, I always use the formatter in the end. So, do you remember go fmt? Yap, it converts all my spaces to tabs again.


I feel like nowadays for this argument it's hard to take the tabs side. The advantage could have been just faster indentation but now editors convert your tabs into spaces automatically so there's really no reason at all to use tabs! Fast indentation + same interpretation across any editor = WIN! 🏆


Its also possible for users to configure their editor/ide to accept a tab character as a series of individual spaces. I can't understand why more folks don't do this. They can still press their single button, but have the precision of the spaces in play.


config file: ~/.vimrc

set tabstop=4 " The width of a TAB is set to 4.
" Still it is a \t. It is just that
" Vim will interpret it to be having
" a width of 4.

set shiftwidth=4 " Indents will have a width of 4

set softtabstop=4 " Sets the number of columns for a TAB

set expandtab " Expand TABs to spaces


Yeah, in VSCode my tab key = 2 spaces. I don't use vim as much but I'll be adding that to my config. 👍🏼


Trend to switch from monospace to ligature might also result in tab preference.

2-4 spaces are only good in monospace fonts.

But we cannot use ligature everywhere, unlike monospace where can find in most places, so spaces will still live.


In different IDEs tabs are interpreted differently but spaces aren't , so its safe to use spaces.


I prefer the granularity of spaces, but the efficiency of tabs. So the obvious compromise is to configure your editor so that a tab generates a tab's length of spaces.


Tabs, because instead of clicking the spacebar 2-5 times, depending on your indentation, you customize the tab width and click it once.


Why would press space repeatedly though? Every decent editor I've used in the last 20 or so years can expand tabs into a configured amount of spaces.


You can set an IDE to use the TAB button to place spaces. Takes 5 minutes and you now have the precision of spaces. I posted a quick 4 line above you can add to a VIM config. Give it a try.


Spaces, but the golden ratio expression of depth.

spaces = ceiling(IndentLevel * 1.615)


Tabs, because it's more friendly to people with visual disabilities.

But I use whatever the projects uses. Code style is the law.

Classic DEV Post from Aug 1 '19

Which loading GIF do you prefer?

I made some loading gifs

Heroku profile image

Code[ish]: a podcast from the team at Heroku, exploring code, technology, tools, tips, and the life of the developer.