Maybe you’ve never seen an entire app expressed as one giant point-free expression lacking concrete…
Eric Elliott
192

I find the issue there is usually just jargon. It’s fine to write really abstract code, but do try to find words to express what you’re doing. If you can’t find words to describe what you’re doing, then yes, it’s probably too abstract. If the best variable name you can think of is “x”, you probably need to tone down the abstractions a little.

The two best tricks I have to avoid write-only code:

  1. Code review — Show your code to someone, explain what it does. The parts that are hard to explain now will be hard to understand later.
  2. Rewrite your functions. Make a habit of deleting a function and rewriting it from memory. I notice this often improves the clarity and readability (it even fixes some bugs from time to time). Hack the first version, delete, write the proper version. This also helps keep down the size of your functions I feel.
One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.