If a function reaches a state where it cannot proceed in any useful way, it should return. There is nothing else for it to do.

The assertion that is approach is "driven by anxiety more than intelligence" dismisses, with unwarranted disrespect, decades of experience in embedded and mission-critical systems where thorough, clean, and readable error handling is one of the hallmarks of good coding. In such applications, parameter validation, diagnostics, and internal consistency checks are likely account for the majority of the lines of code. And in things like critical infrastructure and safety-of-life applications, that is all right and proper. To force error checking into a forest of if..then..else quickly makes the code very difficult to verify, test, and debug.

David Allen Burgess
David Allen Burgess

Written by David Allen Burgess

I have worked in telecom since 1998, in both SIGINT and in commercial equipment. I also do expert work in legal cases, see http://telecom-expert.com.

No responses yet