What I really, really hate is this …
if (x==y) {
  …
 }
simply because the block delimiters don't line up. A far better style is this…
if (x==y)
 {
…
}
I've seen coding standards that do it the right way, but I don't recall ever seeing it written the right way in a coding book. People may argue the right way this wastes a line. Bollocks! For the sake of readbility, a bit of white space delineates blocks quite nicely. Where you don't need it is when the block is very short. For example, both
if (fileIsOpen) {closeFile();}
and
if (fileIsOpen)
  {closeFile();}
are fine.
Python doesn't have this problem. It's one of the main reasons I like it.
No comments:
Post a Comment