Thursday 8 September 2016

Why use Spaces over Tabs for Indentation in Code Editors - Eclipse

When I started coding in Eclipse, I was not aware that by default Eclipse uses tabs for indentation and tabs can have varied with e.g. 1 tab can be equal to 2 spaces or 4 spaces or even 8 spaces. Sometimes, It's all up to you how you configure tabs in your code editor and other times just the mercy of the tool you don't know how to configure e.g. VI in UNIX. I only realize the problem when I found too many difference in a file while check-in into SVN. Apparently, other people was using different indentation (spaces) and that's why the file was showing so many differences when I reformatted them in Eclipse. This happens to many programmers, some pay attention, some didn't and go ahead with the check-in the code, only to revert it back later. There is no clear guideline upon which one is better and whether a programmer should use tabs or spaces, even the Clean Code doesn't  help here.
Read more »

No comments:

Post a Comment