AdobeStock_137184305.jpeg

Managed Website Hosting and Support

The Great Debate: Spaces vs. Tabs

One of the more trivial debates in the coding world is tabs vs. spaces. Whether or not you use a tab or spaces to indent lines of code has had a surprisingly polarizing effect in the coding world, mainly because people will either fall in to one category or the other. Because code is typed as raw text, all formatting is created line by line, and formatting typically serves an aesthetic purpose, it is the visual language that programmers use to communicate.

Here’s how to break it all down. Historically, there have been two ways to create white space in code, tabs and spaces. Tabs require fewer keystrokes to accomplish, and is easier for the computer program to remember as it is registered as one keystroke, but tabs can be imprecise. Spaces can create more precise coding, but it takes more keystrokes, meaning more time used and more storage space used.

While there is no wrong or right way to do it, it is all personal preference. The issue with tabs vs. spaces is the infighting that it can cause within a team of programmers. Studies show that programmers can read code faster if it is in the format they usually use. If a team of programmers get caught up in fighting over formatting, then it becomes an issue. Invariably there will be different opinions on formatting when you are working on a team. Luckily, newer software out today handles formatting on its own, so it doesn’t have to tear a team apart. In the end, the only time there will be zero disagreement on code formatting is when you work on a project alone.

SHARE THIS STORY | |

Search

Recent Posts

Posts by Topic

see all

Subscribe to Our Blog