Closed potomak closed 11 years ago
Hello @potomak, I understand the request, but don't agree about it :-) Coding style is subjective, there are obvious things that should be quite general to make the code easy to understand, but to argue that 2 spaces indentation is better than 4, is going to be really hard.
For instance I think 4 spaces are a win since you have a warning when indenting too much, and because it is easier to scan the code this way. For multiline blocks using {}, this is simply different than what most other programming languages do, so if {} works with multi line in Javascript and C for example, there is no reason it does not work well for Ruby that is syntactically pretty similar. Actually to find in a coding style the advice to use two different forms at the same time rings a bell in my head.
So I think this page is just a number of mostly arbitrary decisions, half of which are broken IMHO, hence, closing :-)
Well, I respect your decision, but I feel at home when I see Ruby code that follows (at least) some of the rules cited at https://github.com/styleguide/ruby, that's why I proposed this update.
Anyway thanks for the quick response. Even if I disagree with some of your decisions I love the way you're managing this project.
I absolutely agree with you that when one is used to a given stlye, it feels much simpler to read the code. Even changing font or syntax highlight type for the first minutes may be challenging... I think that's because our brain adapts to scan things like { } or begin / end.
Btw that's exactly why I'm not excited about begin / end block types, because every Ruby programmer is exposed to { } blocks at least because of Javascript, but on the contrary who writes mostly C, Javascript, Java, and other languages using { } blocks, have an hard time scanning Lua / Ruby written using begin / end style code blocks.
So definitely this really has a lot to do with tastes and habbit, I can see this clearly in the way I changed the way I write C code over the years... I switched from 8 spaces tabs to 4, but still retaining the 80 columns limit, since 8 space forces you a bit too much into splitting functions in very small ones. Then I started to gain as much as vertical space I could, so nowaday I write:
if (condition) callThatFunctioin();
Always declare functions without newlines before {, like in:
int foo(void) {
}
And so forth, while a few years ago I would use standard tab indentation and always go to the next line before a { character. That's just to say that taste is not only relative to one single developer, but to a given developer in a given time :-)
Cheers
Indentation of 4 spaces instead of 2.
Multiline blocks use
{...}
.Reference https://github.com/styleguide/ruby