How I write code: 1
How I write code:
1. Write small, focused, well-named, pure functions.
2. Compose related functions in well-named modules.
Result:
✔️ Easy to understand each function in isolation
✔️ Easy to understand how each module interacts with the outside world
✔️ Easy to test
As Rich Hickey points out in “Simple Made Easy”, complexity is caused by weaving concerns together.
I find pure functions help avoid complexity by creating small pieces that can be tested in isolation, but easily composed as needed.