By activa
via blog.activa.be
Published: Mar 10 2008 / 12:14
Using empty lines in source code may seem like a waste of precious screen space, but it's crucial to writing readable code.
By activa
via blog.activa.be
Published: Mar 10 2008 / 12:14
Comments
Kirill Grouchnikov replied ago:
Lost me at the "correct placement of braces".
activa replied ago:
That's just a matter of personal taste (although I also have an opinion about that :) But this is not exactly what this post is about.
willcode4beer replied ago:
Everybody has an opion about that, thus Kirill's comment.
OTOH, if the writer actually made consistent use of curly braces, he wouldn't have to insert so many blank lines
Lars Pohlmann replied ago:
When I have to go over code of my co-workers I often find myself inserting lots of empty lines (at the right places) to get a better overview.
antych replied ago:
Blank lines should only be used to group code, not format it. I hate when people put them in almost every second line, allegedly to increase readability. It has the opposite effect, you need to scan more lines, or worse scroll more than one screen. You write readable code by keeping it clean, elegant and small. If you need to resort to many blank lines, you already failed.
activa replied ago:
I agree, but what is regarded as a "group" of code? Some people think a method is a single group of code :-)
eelmore replied ago:
If your code isn't readable without inserting empty lines (or worse, lines with only an opening brace { ), then it's probably not an issue of formatting--perhaps it's a sign that you need to refactor such a lengthy segment? It's quite distracting when there's so much useless whitespace that I need to scroll unnecessarily. It's also very distracting (and dare I say, UGLY) to have an opening brace on a line by itself--I don't know any gifted or disciplined developers that still use that style. On the other hand, I agree that some horizontal white space is a very good thing.
Voters For This Link (15)
Voters Against This Link (9)