Skip to content
0:00 / 0:00

#structuredprogramming#goto#controlflow

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

cpponsea

18K subscribers • 4 videos on Hallway

YouTube
  • Recommended by 2 people: 2 on Hacker News.
  • Presented by Kevlin Henney, independent consultant
  • An opinion. It argues one side of a question engineers disagree on.

Intermediate. Assumes working knowledge.

245K views7 years ago2 recommendations

Software designProgramming languagesDesign patternsSoftware architectureRefactoring and legacy code

Kevlin Henney explores the history and principles of structured programming, arguing for its continued importance in writing readable, modern code.

cpponsea.uk Structured programming. That's so 1970s, right? It was all about gotos (or not) and has no more relevance to current programming practice, with its exceptions, threads, object models, functional hand-me-downs and refactorings, than flared trousers, disco or punk. Or perhaps there is and always has been more to structured programming than this oversimplified view? This session looks back at the thinking that motivated and informed structured programming, from "Go To Statement Considered Harmful" to block-structured code and its realisation in object orientation, from formal reasoning to design by contract, to look forward at its enduring implication for modern programmers, namely being able to understand and reason about the code they are looking at. --- Kevlin is an independent consultant, speaker, writer and trainer. His development interests are in patterns, programming, practice and process. He has been a columnist for a number of magazines and sites and has been on far too many committees (it has been said that "a committee is a cul-de-sac down which ideas are lured and then quietly strangled"). He is co-author of A Pattern Language for Distributed Computing and On Patterns and Pattern Languages, two volumes in the Pattern-Oriented Software Architecture series. He is also editor of 97 Things Every Programmer Should Know. He lives in Bristol and online. cpponsea.uk/2019/sessions/the-forgotten-art-of-structured-pr… Filmed and Edited by Digital Medium Ltd: events.digital-medium.co.uk Enquiries: events@digital-medium.co.uk

Why it's here

2 people recommend this

What people say. Recommended for its insights into how control flow structures like if-else and return affect the cognitive load of reading code.

kbensonon Hacker News • Recommends

On “Using the switch(true) pattern in JavaScript”

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. 1: link to this video

jiggawattson Hacker News • Recommends

On “Linux: Using goto In Kernel Code (2003)”

…guments 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 Art of Structured Programming - Kevlin Henney C++ on Sea 2019": link to this video Similarly, this article makes a very good argument that concurrent or async code is essentially the "goto spaghetti reinvented, but even worse ", and that Structured Concurrency is the solution: link…

u/SamTheSpellingBeein r/gameenginedevs • Mentions

I'm making mobile games using my own engine and language Hello! Since this seems like a nice community, I thought I'd share something about my own engine. I've been making games professionally for quite a long time, and have always been working on custom engines on the side. Every time I felt like I hit a wall. The engine didn't quite fulfil all the hopes and dreams I had, and I would have to rethink my approach. I'm feeling really good about the latest attempt. I enjoy working with it, and I have published some nice quality games using it. What makes this last one special is that I built a custom scripting language for it. Why a custom scripting language? Well, I came to realise that I…

shadowofneptuneon Hacker News • Mentions

On “Making Wrong Code Look Wrong (2005)”

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 ( link to this video ) is that if you only looked at the block structures, could you tell that the rest of the code might never run?