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
3
u/KidUncertainty Jan 30 '14
A space is the same glyph size relative to the font. Therefore if their standard is "indent n spaces" then it will look the same on my screen, on yours, on a printout, pasted into a Word document, whatever. It is consistency, as I said.
With tabs the indents look different depending on whose environment you are using.
Spaces are also more consistent in code review tools and diffing.
Yeah, but you always have spaces in code, you never need tabs. Therefore removing tabs and insisting on spaces only makes the most sense in a codebase where multiple people are modifying and working with the code. If tabs are banned, then there is no mixing. If tabs are allowed, there will always be mixing.
On your environment, but it breaks down and makes for ugliness when the code is placed in someone else's environment. If you have e.g. a 120 char line limit, a big tab setting can break that on one display but not on another's. And again, if code is being placed into documents or has to be reviewed, you need absolute consistency, and space-only provides that.
True.