4 ms·
For a body of code written by multiple people to be readable, it helps considerably if the conventions those people follow are consistent. I'm not convinced of
by abstractbill 17y ago
For a body of code written by multiple people to be readable, it helps considerably if the conventions those people follow are consistent.
I'm not convinced of this (at least it doesn't hold true for me). I used to believe it, mostly because it seems to be common wisdom. But I've realized over time that I can just as easily read code that's written using K&R style braces, or BSD style, or even Whitesmiths, and it really doesn't matter to me whether indentation is 2, 4, or 8 spaces.
I think some of my point of view comes from being a heavy Emacs user and having written a lot of Lisp code in the past. I don't tend to see braces/parens much for example - I let the editor take care of them.
- Legion 17y agoIn terms of reading a complete body of code in one style or another, I agree. What is annoying and distracting is having conflicting styles in the same single chunk of code. Sort of like how I would not want a book to randomly change line spacing, character spacing, etc. from paragraph to paragraph. I don't really care what the spacings are, and I certainly have no problem going from one book to another where these are totally different, but I do not want them flip-flopping around in the text of a single book.
- nostrademons 17y agoI can easily read code that's written with 2, 4, or 8 space indentation. I can't read code that's written with 2, 4, or 8 space indentation at the same time. The most important part about code conventions is that you have them. It really doesn't matter what they are. In fact, I wish fewer styleguides would pretend to be right and more would just acknowledge that they're simply whatever the originator prefers. But it's still very important that everyone agrees to follow them, even if they disagree with some of the individual aspects.