❝HN 片单

The Forgotten Art of Structured Programming - Kevlin Henney [C++ on Sea 2019]

cpponsea · 2 位 HN 用户推荐 · 2021–2021

  1. If you haven't seen it, Kevlin Henney's talk about "The Forgotten Art of Structured Programming"[1] is interesting (if somewhat long in the examples later), and somewhat related. It's not specifically about return early (and a case could be made that it should or should not apply specifically to early return), but it is about if, else, return, and how they affect cognitive load when reading code.
    — kbenson, 2021
  2. The "goto" keyword is similarly dangerous. I've seen very good arguments for leaving it out, and generally poor arguments for keeping it in a language. "I can use it safely" is not a good argument, because it's just like Jim Jefferies' standup routine linked above: "Why should I have my guns taken away from me?" An example of a good argument for structured programming is the talk "The Forgotten A
    — jiggawatts, 2021

← HN 片单