Show HN:我写了一本书:《代码的要素》

1作者: johnmwilkinson9 个月前
嗨,HN! 我写了一本关于编程的书,名为《代码的要素》。我把整本书都放在这里了:<a href="https:&#x2F;&#x2F;elementsofcode.io&#x2F;" rel="nofollow">https:&#x2F;&#x2F;elementsofcode.io&#x2F;</a> 在指导(通常是新)程序员时,我注意到他们有一些常见的错误,这些错误似乎占据了他们代码复杂度的 80% 左右。我找不到一份简洁的指南来纠正这些错误,所以我决定写一本。 书名是对 Strunk 和 White 的《风格的要素》的致敬,后者是使用散文进行良好沟通的经典指南。那本指南本质上是非常战术性的,我想在《代码的要素》中也保持这种侧重点。因此,TEOC 试图不关注抽象概念,而是针对具体的实现。它避免讨论软件设计,而倾向于代码构建的细节。当然,设计和实现、战略和战术从来都不是完全分离的。在必要时,会包含一些抽象概念来帮助提供背景。 这本书的主要重点是沟通:我们如何编写其他程序员能够理解的代码?我们如何减少他们理解代码所需的时间? 我把它全部免费放在网上,因为我更希望这本书能被阅读,而不是赚几块钱(当然,也欢迎购买!)。我真诚地希望读者能觉得它有帮助,并给他们提供新的工具和一种新的思考编写代码的方式。 我很想听听你们的想法,我会尽量回答问题。谢谢!
查看原文
Hey HN!<p>I wrote a book on programming called The Elements of Code. I put the entire book online here: <a href="https:&#x2F;&#x2F;elementsofcode.io&#x2F;" rel="nofollow">https:&#x2F;&#x2F;elementsofcode.io&#x2F;</a><p>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.<p>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.<p>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?<p>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.<p>I’m interested to hear what you think, and I’ll try to respond to questions. Thanks!