Show HN: I wrote a book: The Elements of Code
Hey HN!
I wrote a book on programming called The Elements of Code. I put the entire book online here: https://elementsofcode.io/
When mentoring (usually new) programmers, I noticed there were a few common mistakes that seemed to account for about 80% of the complexity in their code. I couldn’t find a concise guide to fixing those mistakes, so I decided to write one.
The title is an homage to The Elements of Style by Strunk and White, which is the classic guide for communicating well using prose. That guide is quite tactical in nature, and I wanted to parallel its focus in The Elements of Code. As a result, TEOC tries not to focus on abstract concepts, and instead targets concrete implementation. It avoids discussing software design in favor of the minutiae of code construction. Of course, the design and implementation, the strategy and the tactics, are never entirely separate. When necessary, some abstract concepts are included to help provide context.
The primary focus of the book is on communication: how can we write code that other programmers will be able to understand? How can we reduce the time it takes them to understand?
I put it all online for free because I would rather the book be accessible and read than make a few bucks (though purchases are certainly welcome!). My sincere hope is that readers find it helpful, and it gives them new tools and a new way to think about writing code.
I’m interested to hear what you think, and I’ll try to respond to questions. Thanks!