Programming Styles in the Node Community
dailyjs.com
dailyjs.com
I wanted to see more about how programs/modules are organized Yes, they mention how TJ puts an index.js so he can require everything in one line, but that was just a footnote it felt like.
Personally, I think that the more important is that your all team has the same coding style and to be capable to adapt to another coding style when necessary and when you change of language.
Generally it's better when your coding style looks like the one of the language creator.
Win win :)
I can attest firsthand this causes bugs. 2 spaces just isn't enough to reliably visually identify the horizontal separation.
Python got this right with PEP 8. CoffeeScript did not and is worse for it.
As for it causing bugs, bugs are like cancer -- they are caused by everything.
What I can say though, is that there is a correlation between a lousily indented code and bugs. Consistency is the key in indentation. Reading non-consistently indented code, that's what drives you insane... but two instead of four spaces... hardly.
I have no problem with 2 spaces in C/C++. I have no problems with Pythons use of white-space to define blocks. But the combination is deadly.
No convention can solve things like var hoisting, this changing meaning in callbacks, etc, etc. So people come up with some really strange coding styles to try to route around them -- which good programmers will hate, even if they are not entirely sure why.
Is the two-space indentation relatively new? Or has it always been seen around in the JS community?
Javascript uses in an event driven environment (like a browser of node.js) can encourage some pretty deep nesting so perhaps people use smaller indentation granularity for that reason.
So it is actually really old.