The Forgotten Art of Structured Programming - Kevlin Henney [C++ on Sea 2019]
Channel:cpponsea · Length:1:29:27 · Published:2019-02-15 · Views:245223
Summary
Kevlin Henney revisits structured programming, from Go To Statement Considered Harmful to block-structured code and object orientation. He argues it still matters for how we write code today.
Why HN recommends it
HN commenters point to it in discussions of goto, early returns and cognitive load when reading code.
Programming language design · C, C++, Rust, Go & systems languages · Software architecture & design
Subtitles (excerpt)
so what we're here to talk about this is a Jackson Pollock picture it's here just because it's here because one of the most intriguing things about Jackson Pollock's artwork somebody actually sat down and studied it it turns out that it is fractal it is scale free which is quite impressive given that he did it by did it by hand it's not just random splashes it's scale free which has everything to do with software software is effectively scale free you make big bits of software out of small pieces of software you make those out of small pieces of software and so you know Turtles all the way down and what's important about that is that this structure this concept of structure is very different to our normal physical relationship to structure physical relationships structure you build buildings not out of smaller buildings but out of bricks and you don't build big bricks out of smaller bricks that's not how it works so in the real world many of our structures are you change the scale you change the medium you change the rules but that's actually not the way that it works in code so what I'm going to talk about is that's the trolling version of the title the full version of the title is this and so in order to understand
On Hacker News
I get that, but the comment was specifically about pointers (not gotos or structure), and is interesting in general from a historical perspective. 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 … — jiggawatts, 2021-07
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-04
For some of these reasons, I prefer to write this: if (condition) { throw } else { <rest of code> } Rather than: if (condition) { throw } <rest of code> The justification, which I found in this presentation ( [VIDEO] ) is that if you only looked at the block structures, could you tell that the rest of the code might never run? — shadowofneptune, 2022-09
Related videos
- CppCon 2019: Matt Godbolt “Compiler Explorer: Behind The Scenes” · CppCon · 1:00:21
- Twitter and Visual Studio Rant · Molly Rocket · 38:19
- Arithmetic, Population and Energy - a talk by Al Bartlett · lXlSalemlXl · 1:14:45
- CppCon 2016: Nicholas Ormrod “The strange details of std::string at Facebook" · CppCon · 31:18
- LISA11 - Fork Yeah! The Rise and Development of illumos · USENIX · 1:04:03
- How big is a visible photon? · Huygens Optics · 20:33
- CppCon 2015: Andrei Alexandrescu “std::allocator...” · CppCon · 1:12:27
- BOLTR: Juicero, Cold Press Juicer for Rich Weirdos · AvE · 41:39
- Every Ruler Makes the Same Mistake When They Die · CGP Grey · 5:38
- Line Goes Up – The Problem With NFTs · Folding Ideas · 2:18:23
- Plenary: Performance Matters - Emery Berger - CppCon 2020 · CppCon · 1:01:08
- [EPILEPSY WARNING] How fast should an unoptimized terminal run? · Molly Rocket · 51:03
- Refterm Lecture Part 1 - Philosophies of Optimization · Molly Rocket · 18:41
- How Big is Graham's Number? (feat Ron Graham) · Numberphile · 8:23
- Jim Jefferies -- Gun Control (Part 1) from BARE -- Netflix Special · Jim Jefferies · 7:47
- Why don't Americans use electric kettles? · Technology Connections · 24:55
- The Closest Thing We Have to Alien Technology · Veritasium · 55:00
- Refterm v2 - Resource usage, binary splat, glyph sizing, and more · Molly Rocket · 29:51
- Brick Assembly · Ancient · 12:27
- The Only Unbreakable Law · Molly Rocket · 53:25