I’ve recently had two instances of studying some innocent looking code, only to realize it’s riddled with something you are ordinarily actually recommended to do. “If a function is too long, separate blocks of code into separate functions!”
Yes, that’s all nice. This rule rocks, but not when you go and insanely apply it to rather short functions.
Remember: most IDEs don’t allow easy browser-style navigation: click on a symbol name, read, then go back. This means reading complex code, spread over several functions spanning hundreds of lines of code if you look from top to the bottom… this is horrifying, and studying that code is near impossible.
If goto is considered harmful, don’t ignore the fact that function call is a hidden goto; in some cases, a wolf in sheep’s clothing.
Now, if I tell you one of the instances was some (supposedly relatively simple) sample code by a well known software company…
Image source: xkcd
Tip me with Bitcoin to: 1ASA9q5VQUxPZvit8X2AP4JYzPcSDk7dFV or using ChangeTip (button below)