JAVA braces style
There is a good way to put braces in java !
Yes I know, everybody say I put my braces this way and it’s the way I like, but please, you have to think of people who read your code (to debug it, when it’s a stressful moment).
At school I was a big fan of the braces at the end of the line like this :
So yes, this is compact and everything is clear, but during my reading time I need more space to read. Cause if the code is too big with a lot of function and condition it’s not natural so see what happen.
All I see is that :
It is impossible if you see it from far away to really understand what happen in the code, where is my if, where are my argument…
So if we want something more readable, you have to put your braces at the next line. Everything is more clear on your code as you can see bellow. You can immediately see where there are condition in your code.
If we do the same things, you can see that is much better. There are space between the parts of the code and we immediately understand what happen in the code without reading anything.
So please consider this way to but your brackets, it will help a lot your reader and people who come after you on your code, especially if it’s me :)
Source : https://vimeo.com/97329157 — That’s a really interesting conference about a 7 ineffective Coding Habits of Many Programmers