“I just can't recommend it enough.”
500 Lines or Less
用不到 500 行代码实现真实软件,逐章拆解设计取舍
这是一本由多位作者分章撰写的文集,每章用不超过 500 行代码实现一个真实可运行的程序,并讲解其中的设计思路和取舍。内容涉及多种类型的软件,不少章节用 Python 实现,包括 Guido van Rossum 写的基于 asyncio 的网络爬虫。和只讲架构概念的书不同,这本书让读者直接读完整的小型代码库,适合当作读源码的练习。
HN 上的人把它当作读真实代码的入门材料推荐:项目小、不吓人,每章还配有分析,既能学 Python 也能看到不同类型软件的核心实现;也常拿 Guido 的 asyncio 爬虫章节举例。
想通过读小型真实代码学设计的中级开发者
怎么读
由 Claude 根据这本书和 HN 上的说法整理,可能有错- 1先看目录,挑自己熟悉或感兴趣的一章读,不必按顺序
- 2读完设计讲解后,把代码下载下来运行并改一改
- 3Guido 的爬虫一章适合想学 asyncio 的人先读
- 4可与 The Architecture of Open Source Applications 配合着读
HN 书评
推荐在前,同类按时间 · 每本最多保留 20 条,统计用全部提及 · 作者本人贴的不算“a fourth is being worked on which is very relevant to this posts query. There isn't much too it yet, but its working title is 500 Lines or Less”
“This is a repo of smaller real world applications that are 500 lines or less in length, so as not to be overwhelming to novice / intermediate programmers.”
“This is a collection of real applications that are written in 500 lines or less. The goal is to teach python through real projects that are not too complicated to understand.”
“500 Lines or Less and I'm looking forward to reading it too.:)”
“The goal was to be a resource for intermediate python developers to be able to look at real world applications. Hope this helps.”
看全部 20 条 →
“There's also "500 Lines or Less" which is a part of the effort:”
“It's especially interesting because it takes advantage of new Python features like asyncio.”
“The best I have so far come across in a book is "Coders At Work". 500 Lines or Less promises to be another.”
“Maybe starting with a project like this would help? 500 Lines or Less”
“Often they are pedagogical in purpose, but sometimes on accident due to ruthless factoring.”
“Same, I really like the book 500 Lines or Less for this as well:”
“If you are looking for inspiration try '500 Lines or Less' [0]. It includes in-depth analysis of projects at hand and implementation.”
“500 Lines or less [1,2] might be of interest: it doesn't build up a single complex project from scratch, but it several show the core implementation of various complex types of software.”
“Created an account to point out this gem by Guido himself that makes use of this and the fact that python variables are not scoped inside for loops:”
“A list of classics like the Architecture of Open Source Applications project (链接) to accompany the short stories in 500 Lines or Less”
“There are also projects like 500lines where it's a book and you can help out with all types of editorial-type tasks.”
“Guido van Rossum, the creator of Python, wrote a web crawler as a motivating example for asyncio. You can find the code for it here:”
“I was able to build the PDF on Fedora 23 [1]. Ended up with no front page but the content is there.”
“For an example, look at Guido van Rossum's crawler [0].”