The Forgotten Art of Structured Programming - Kevlin Henney [C++ on Sea 2019]
Video Statistics and Information
Channel: cpponsea
Views: 187,663
Rating: undefined out of 5
Keywords: c++, C++ on Sea, cpponsea, Folkestone, C++ Conference, Conference, Programming, C++ on Sea 2019, c++ tutorial, c++ programming, computer science (field), Structured Programming, The Forgotten Art of Structured Programming, The Forgotten Art of Structured Programming - Kevlin Henney, Kevlin Henney, Kevlin Henney c++, Kevlin Henney 2019, Go To Statement Considered Harmful, block-structured code, object orientation
Id: SFv8Wm2HdNM
Channel Id: undefined
Length: 89min 27sec (5367 seconds)
Published: Fri Feb 15 2019
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.
I love the guy for keeping the name of Algol68 in the public consciousness. Two-level grammars rule!
I don't mean to offend anyone, but this is an awful talk. It is most clear in the realloc example. The changed version is much worse than the original one. The original one will let you know right away that the function path ends when you enter one of these if blocks. You don't have to wonder whether the function does some additional changes to the return value - the execution is done at that point and you can continue reading the code, leaving more mental space for understanding the rest of the code.
On another note, if the size of the 'structured' realloc function grew, the chance for an error will also increase due to the increased chance of someone writing code that affects the return statement outside the if-chain and that would end up affecting the rest of your return statements.
Also, the guy claims that the 'structured' variant of the function will be more refactor-able, but in reality, both are equally refactor-able.
The two code functions are equivalent therefore which one you will use is up to you.
I think that the guy is promoting a coding style that he is used to, which in return is based on his original experience with a language that is no longer in heavy use. I don't see any benefit from this coding style, at all.
What's, even more, is that it doesn't really matter. If you are working for a good company these types of semantics will be covered in some coding guidelines and you will not even have the choice of whether to use this particular style or not.
TL;DR: If you have not yet watched the talk - Don't. There isn't anything in there that is worth an hour and half of your time. Just some guy promoting his old coding style and garnishing it with quotes from a lot of books that have little to nothing to do with the subject.
Great talk!