Item 35: Treat Line Breaks like Paragraphs

A big part of how well an idea is represented in code is the code itself's readability. Here's a simple and easy way to enhance it:

Treat logical groupings of code like a paragraph by inserting a line break in between them.

Doing this forces you to do two things that help with the readability of your code:

  1. Group related pieces together
  2. Create a logic narrative in your method body as to what is going on.

This structure and organization goes a long way in aiding readability, but really also helping you clarify your idea. When you're putting ideas into code, you are spending a lot of time with the idea and getting used to its meaning, like most writing. The more you do so, the more you will understand your idea.

This also has the added bonus of making it so people (your future self included) can go back and have an easier time figuring out what's going on. They can scan the page, see the logical groupings, and make sense of it with less brain power.

Caveat that in some languages this can't work or breaks convention but for most cases you should be good.