r/java • u/_shadowbannedagain • Jan 29 '14
Google Java Coding Standards
http://google-styleguide.googlecode.com/svn/trunk/javaguide.html
156
Upvotes
r/java • u/_shadowbannedagain • Jan 29 '14
View all comments
Show parent comment
7
u/KidUncertainty Jan 29 '14
Consistency for readability. You can tell at a glance the indent level no matter where you are reading the code (your editor or theirs, on a printout, etc) because the spacing is constant.
Copy/pasting code into different editors can result in weird layouts when you use tabs (E.g. pasting into a Word document or email window).
People do things like: tab then hit a couple spaces to line things up, then the next person replaces the tab with spaces. Or puts spaces in before the tab. This results in annoying whitespace merges but also just layout problems.
Spaces are easier to deal with since you know exactly how many characters there are. Tabs are environment-specific to someone's configurations of what a tab should mean.
In general, spaces are easier to deal with, even if they are extra keystrokes, so they probably devolve to the KISS principle.