Coding style & structure

I was reading Ken Arnolds “Style is Substance” essay this morning (as part of Joel Spolskys book “The Best Software Writing I“) and can’t resist to add my 2c worth (plus I won’t tell you were I was sitting when reading the essay 🙂
Coding Style doesn’t matter. It doesn’t matter where you put your curly braces (as long as you’re doing it in a consistent way).
What does matter is

  • that your code clearly expresses your intent
  • doesn’t violate the DRY principle

If you do that, your methods will be short enough to make coding style irrelevant – magic. Because coding style will get in your way only if it is used to structure your code. And code isn’t structured by a certain coding style, it is structured by classes and methods and design principles on how objects should work together.
It’s just easier to debate white-space & curly braces. Everyone can do that. But not everyone can write clear code. Spend your energy on improving your coding skills.
It took me years to come to this conclusion. Don’t make the same mistakes I made.
And, BTW, of course, as long as you’re working in my team, you are supposed to put your curly braces where I say they belong 🙂

Comments are closed.