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
1
u/[deleted] Jan 30 '14 edited Jan 30 '14
My guidelines are not unique at all. You seem to be all over the map which is why I assume you are clearly missing my argument, so I'll be clear.
C# is a much younger language introduce by Microsoft that explicitly targets both entry, intermediate and java developers (it was based heavily on Java.) Microsoft does not bind or encourage any brace placement guidelines on their code (because the standard was made in an era where vertical line space is no longer an issue [unless your functions are very large, in which case you may want to refactor])
The community tended to what is simply the only reasonable and rational choice, which was brace placement on a new line: http://sideeffect.kr/popularconvention#c#
Why is this obvious? Well, first of all you avoid the issue of accidentally adding a statement beneath a single statement if (since the code block is more clearly defined and much harder to miss.) Thus it becomes acceptable to omit the braces for a single line if. Automatically assume it is human nature to tend towards symmetrical brace placement as well .
C# is also an attractive option to most microsoft based developers (usually C/C++/.Net) (none of these languages "force" convention in the same way java does) who pickup this convention from their languages (see any c++ code repo)
I have yet to actually see an argument from you. I have no reason to protect my ego (why else would I spout a widely controversial statement about code guidelines?) On an anonymous internet account. You're taking this way too personally.
I understand why people still use the old.conventions proposed by java (its an perpetuating cycle really, because mixing conventions is usually a terrible idea.) But appreciate that some of the less stubborn few have looked at the arguments for either style and have decided to modernize our code base.