Vlad's Roam Garden

Powered by 🌱Roam Garden

employ the power of natural language to improve readability

Humans are adept at parsing natural language so it's a good thing to strive to utilize that for writing code.

I feel a bit hesitant to assert that we should strive to match natural language fully, as there is power in succinctness and abstraction

Examples

Kotest and Hamcrest with their custom matchers is a great example of applying this principle to testing.

Spec style testing/BDD in general seems like a good application of this.

How do you balance succinctness and readability?

You want your prose to be terse in this context.

Succinctness is good when it is accomplished by rising level of abstraction/syntax

It is not so great when accomplished by omitting details in a way that makes code structure less explicit?

For example when it hides temporal coupling between functions

This exposes the temporal coupling by creating a bucket brigade. Each function produces a result that the next function needs, so there is no reasonable way to call them out of order.
You might complain that this increases the complexity of the functions, and you’d be right. But that extra syntactic complexity exposes the true temporal complexity of the situation.
Note that I left the instance variables in place. I presume that they are needed by private methods in the class. Even so, I want the arguments in place to make the temporal coupling explicit.