News for hackers. Stuff that matters.
Re:Ask HN: How to Learn to Code Better? by lhenriquez on Friday July 09, 2021 @12:10AM (#27780402)
The book that improved my code readability, composability and testability the most is composing software by Eric Elliot. https://leanpub.com/composingsoftware

Trigger warning - it shows how to apply functional programming techniques using JavaScript, but the lessons apply to any language. I used to think functional programming was only relevant for grey beards in academic settings where lisp and Haskell were used, not the web apps I develop. I was completely wrong.

The biggest improvement I’ve observed is in testability - I used to dread writing tests because they were hard to write, create fixtures for and brittle. Now it’s fun to write tests and I usually write them before the function, adding rigor to its definition. Tests are easy to write because my functions do one thing, have no side effects, and the inputs and outputs are fully defined in the signature.

There are no comments on this comment yet.