HackerURLs

一次又一次被重新发现的经典。

同一个链接,相隔一年以上,一次又一次被人重新发现、再次冲上 Hacker News 首页。能经受住这种时间检验的,大多是值得一读再读的文章。每篇附中文标题,讨论最热的那些再加上中文导读和高赞评论翻译。

从名人堂开始
  • 4,700+篇经过时间检验的经典

Hall of fame

名人堂

在经典库里看全部精选

上首页次数最多、而且有中文导读的 30 篇。时间轴上每个黑点是一次上首页,空心点是一次没冲上去的投稿。

  1. 正在载入经典…

Archive

经典库

按第一次上首页的年份分布,点柱子筛选。

排序

    About

    这些经典是怎么挑出来的

    1. 01

      合并同一个链接

      读取 Hacker News 自 2006 年以来的全部链接投稿,把 http/https、www、跟踪参数等写法不同的同一篇文章合并成一条。

    2. 02

      只留经得起时间的

      同一链接至少两次拿到 50 分以上(约等于上首页),而且两次相隔一年以上;再由 AI 剔除状态页、产品首页和新闻事件。

    3. 03

      写导读、译评论

      上首页次数最多的 2,000 篇配上中文导读、"为什么经久不衰",并精选翻译 HN 高赞评论。导读由 AI 生成,可能有误。

    编程与软件工程blog.regehr.org

    如何教授 C 语言

    Teaching C

    4次上首页
    8年跨度
    1,012累计得分
    546条评论

    2016 — 2024,它一次次回到首页

    黑点是上首页(≥ 50 分)的那次投稿,空心点是没冲上去的投稿,点越大分数越高。

    导读

    这是犹他大学教授 John Regehr 关于「如何教 C 语言」的一篇博文:他认为 C 课应当让学生理解为什么操作系统、嵌入式系统等关键基础设施几乎都用 C 写,同时也要正视 C 在计算机安全灾难中扮演的核心角色。文中给出了具体建议,比如用静态分析工具、避免滥用预处理器、用真实代码库(好的和坏的)作为教材范例。

    为什么经久不衰:C 至今仍是操作系统与嵌入式世界的底层语言,而「怎样教才不只是教语法」这个教学难题十几年都没变,文中的判断和建议依然站得住。

    关键词 C 语言编程教学系统编程指针与内存

    HN 评论精选

    应像汇编程序员那样理解 C,而现代学生缺少底层机器模型这一环。

    这几年我努力把 C 学透,结论是:最好用汇编语言程序员的思维方式去理解 C,比如 C 的 switch 语句(想想 Duff's device)跟其他语言的 switch 根本不是一回事。很多学生学不好底层 C,是因为他们不再先学汇编,而是从高层语言往下走;他们脑中没有一个冯·诺依曼机器的图像,只懂语法,编程对他们等于上网找一段「魔法代码」复制粘贴。栈帧、堆、寄存器、指针这些概念对他们完全陌生,尽管这些概念本质上很简单。

    robertelder查看英文原文

    In my quest to learn C very well over the past few years, I've come to the conclusion that C is best understood if you think about it in terms of the way that an assembly language programmer would think about doing things. An example of this would be if you consider how switch statements work in C. Switch statements in C don't really compare to switch statements that you find in other languages (eg. https://en.wikipedia.org/wiki/Duff%27s_device). The issue that many students face in learning low level C, is that they don't learn assembly language programming first anymore, and they come from higher level languages and move down. Instead of visualizing a Von Neumann machine, they know only of syntax, and for them the problem of programming comes down to finding the right magic piece of code online to copy and paste. The idea of stack frames, heaps, registers, pointers are completely foreign to them, even though they are fundamentally simple concepts.

    C 的价值在于贴近硬件且不挡路;建议先用 Python 教抽象思维,再让学生亲手实现底层数据结构。

    作为一个在 C 诞生之前就学编程的老家伙补充一点:C 几乎与简单的处理器和内存模型一一对应,最重要的是它不挡路,让你专心解决系统编程问题。在 C 之前,任何像样的系统编程都得钻进汇编里,所以 C 是巨大的进步,这也是它今天仍是嵌入式开发首选的原因。当然系统编程不是今天大多数开发者的日常,这是好事,我们可以在更高抽象层上构建。我很爱 Python,因为它让我在贴近用户问题的抽象层工作;我也很爱 C,当我要拨动 ARM Cortex-M3 上的一个引脚时。我认为 CS 教育应先教问题分解和性能分析,然后像当年汇编是必修核心课一样,让学生花一学期亲手实现并测量那些他们平时「免费」拿到的数据结构。

    dbcurtis查看英文原文

    Let me add the perspective of an old dinosaur that learned to program before C had been invented. C maps nearly 1:1 onto simple processor and memory models, and most importantly, gets out of your way and lets you get on with solving your system programming problems. Before C, just about any meaningful system programming task required a dive into assembly language. In that context, C was a huge win. It is also what makes C the langauge of choice for embedded development today. Of course, system programming problems are not the bread-and-butter of most develpers today -- and a good thing, too. We can now build on top of solid systems and concentrate on delivering value to the customer at much higher levels of abstraction: the levels of abstraction that are meaningful to customers. I dearly love Python because it allows me to work at levels of abstraction that are meaningful to the user's problem. I dearly love C when I want to wiggle a pin on an ARM Cortex-M3. In my mind, CS education should start by teaching problem decomposition and performance analysis using a language like Python that provides high levels of abstraction and automated memory management. Then, just like assembly language was a required CS core course back in my day, students today should spend a semester implementing and measuring the performance of some of the data structures that they have been getting "for free" so that they understand computing at a fundamental level. Some will go on to be systems programmers, and will spend more time at the C level. Some won't ever look at C again, and that is OK. In the end, CS education is about how to solve problems through the application of mechanical computation. The languages will evolve as our understanding of the problems evolve and our ability to create computing infrastructure evolves. CS educcation should be about creating people who can contribute to (and keep up with) that evolution.

    应把 C 作为内核/数据库/编译器的前置课,并补上调试器、错误处理与内存管理、亲手实现语言特性。

    要注意这篇文章讲的是「怎么教 C」,不是「该不该教」。我认为该教,但不是作为入门语言,而是作为学内核、数据库、编译器的前置:这些系统的真实代码大多用 C 写,研读它们是 CS 课程的必要部分,所以学生迟早要学 C,也应当有这个选择。就「怎么教」而言,原文作者基本说到点子上:对代码库好坏的判断和我的经验吻合,用静态分析、避免滥用预处理的建议也靠谱。我只补充几点:不学调试器(多半是 gdb)就不算学会 C,这必须写进教学计划;C 本身不提供错误处理和内存管理,值得更深入讨论良好实践;用 C 实现其他语言里的某些特性(简易面向对象、map/hash、正则解析器)很有教学价值。

    notacoward查看英文原文

    It's pretty important to note this is about how to teach C, not why. Should schools be teaching C at all? I would say yes, not as an introductory language but as a precursor to studying kernels or databases or compilers. Real-life examples of these are mostly written in C, and studying such systems is IMO a necessary part of a CS curriculum. Therefore, at some point students need to learn C. They should certainly have the option, so we still need to address the question of how it should be taught. With regard to that question, the OP seems pretty spot one. The identification of certain codebases as good or bad matches my own experience with most of them. The advice to use static analysis and to avoid preprocessor abuse is sound. There are only a few things I'd add. * You can't really learn C without also learning to use a debugger - probably gdb. That must be part of the lesson plan. * A more in-depth discussion of good error-handling and memory-management practices would be worthwhile, since C itself doesn't provide these. * It can be very informative to implement some of the features found in other languages in C. Examples might include a simple form of object orientation, or a map/dict/hash, or a regex parser. Besides their value as a form of practice, this would expose students to some of the issues and decisions involved in making these a built-in part of a higher level language.

    学生视角:严格的编译选项、Vim 和专门的调试作业让 C 课既难又有收获。

    我在大学读 CS,刚学完「C 编程」这门课。老师一开始就说它比其他课(主要是 Java)难得多,不少学生会吃力。等我搞懂了指针、学会用 GDB/Valgrind 调试之后,这门课变得非常享受和有收获。我们不用花哨的 IDE,被要求只用 Vim,编译时必须加 -ansi -Wall -pedantic,这样只要代码不符合 C90 标准就会报错或警告。13 周里内容很密,但作业我很喜欢:用指针、二维数组和冒泡排序做井字棋记分板;调试一个满是 bug 的程序(我的最爱);还有要求无内存泄漏的动态内存版单词排序。调试那份作业很特别,老师说是因为收到反馈说学生调试能力太差——让他们按要求写代码没问题,但面对已有代码里的问题就束手无策。题目给了约 15 个 bug,按你判断出的原因和给出的有效修复打分,逼着我们用 GDB、Valgrind 这些工具。

    parr0t查看英文原文

    I'm currently at uni studying CS and recently finished my 'Programming in C' unit. The teacher from the get-go said it would be challenging compared to other languages that we had used to date (mainly Java) and that quite a few students struggle with it. Once I got my head around pointers and debugging through GBD/Valgrind the unit came immensely enjoyable and rewarding. We didn't use any fancy IDE's and were told to stick to VIM, we also had to compile with the flags -ansi -Wall -pedantic which alerted you to not only errors but warnings when we compiled our code if it didn't meet the C90 (I think) standards. It was a lot of work crammed into 13 weeks but it had one assignment which I thoroughly enjoyed. Tic Tac Toe (Ramming home using pointers, 2D arrays, bubble sort for the Scoreboard). Debugging a bug-riddled program (My favourite). Word Sorter (Using dynamic memory structures, memory management by having no leaks, etc). The debugging one was very different from most other assignments I had done at uni to date and the teacher said he recently introduced this assignment because the university had received feedback that students debugging skills weren't the greatest. They could write what they were asked to just fine, but when it came to debugging preexisting issues quite a few struggled. We got given a program with around 15 bugs and you got marks depending on what was causing the bug and a valid solution to fix it. This forced us to use tools such as GBD and Valgrind to step through the program and see where the issue was and to be much more methodical. I really enjoyed C and when I find a bit of time outside of work and study I'd like to explore it more.

    历次讨论

    同类还值得读

    1. 开源应用架构

      The Architecture of Open Source Applications

      《开源软件架构》(AOSA)是一本在线免费书,邀请知名开源项目的作者亲自剖析其内部设计,涵盖 SQLAlchemy、LLVM、Audacity、Apache、Bash 等系统。

      编程与软件工程上首页 9 次 · 2011–2024aosabook.org编辑精选
    2. 编程语言简史:简短、不完整且多半错误

      A Brief, Incomplete, and Mostly Wrong History of Programming Languages

      一篇以戏谑、故意不准确的方式回顾编程语言史的博客文章,用夸张轶事和讽刺定义串起 Lisp、C、C++、Java、JavaScript、PHP 等语言。

      编程与软件工程上首页 8 次 · 2009–2021james-iry.blogspot.com
    3. SQLite 是如何测试的

      How SQLite is tested

      SQLite 官方文档页,系统介绍 SQLite 的测试体系:多种测试方法(TCL 测试、模糊测试、回归测试、静态分析等)和海量测试用例,展示了这个小型开源项目如何靠极致测试获得…

      编程与软件工程上首页 8 次 · 2009–2025sqlite.org编辑精选
    4. 高级编程语言(2009)

      Advanced programming languages (2009)

      Matt Might 的经典文章,按用途推荐“高级编程语言”:如果追求就业就选主流语言,如果追求表达力、学术研究或创业,则推荐 Haskell、OCaml、Scala 等函数式语…

      编程与软件工程上首页 8 次 · 2009–2022matt.might.net
    5. 我的 Forth 与栈机器经历

      Yosefk - My history with Forth & stack machines

      作者以亲身经历回顾了使用 Forth 语言和栈式机器的历程:既赞叹其简洁优雅、代码量小、可自举的优点,也坦率指出栈操作在实际编程中的痛苦,以及 Forth 社区文化中的问题。

      编程与软件工程上首页 8 次 · 2010–2024yosefk.com编辑精选

    打赏支持

    打赏二维码

    觉得有用,请作者喝杯咖啡。

    WeChat

    关注向阳乔木

    微信公众号「向阳乔木推荐看」

    微信公众号「向阳乔木推荐看」二维码

    微信扫一扫;在微信里打开本页时,长按二维码识别。