Naming Operations rather than Variables

siiky

2021/12/15

2022/07/07

en

Naming, using, reading, and understanding well named operations rather than (kinda) well named variables grows the habit of reading and understanding code rather than relying on variables being well named -- and everyone knows naming is hard.

Bad:

Good (using procedural composition):

Better (if the chain of operations is long):

Best (using functional composition):

It also comes with rather nice advantages. Just compare the two approaches in each scenario:

And a final bonus: the "better" approach is easier to read than the "bad" approach, and requires less typing, thank you very much.