869 private links
I always wanted to write an article about how to write readable code. This article did it for me!
The core idea is that our brain has a small working memory. We are able to hold 4-6 things simultaneously, but no more. So to make the code more digestible, we need to abstract related things together into a bigger chunk if there are more than a handful of things to be dealt with.
Another thing the article didn't mention is that we can use symmetry to reduce the amount of memory needed. Symmetrical things require fewer places in working memory. "match cases" and "pipelining operators" are useful to construct symmetrical structures. The structures hints the brain on what to expect and we know the sub-expressions are equal in rank. This is why I am against using pipeline operator in places where there is no pipeline semantics (each step should be an endofunction).