Quote of the week – judgement

A superior pilot uses his superior judgment to avoid situations which require the use of his superior skill.

Frank Borman – Apollo 8

I once had a programmer tell me that he had to use a goto because he needed to jump out of 10 levels of nesting (in C++ code). In the most literal sense he was correct – a return or an exception would not have worked in this situation. Of course he should never have got into 10 levels of nesting in the first place.

Sometimes the best solution to a problem is to back out and change the system so that the problem just doesn’t exist.

(For the avoidance of doubt, I am not claiming that using a goto qualifies as “superior skill”, but it is an extreme way of getting out of a problem. Also, I am not (entirely) anti-goto. If I ever come across a situation where a goto is the best way to achieve something in C++ I will use it. I have just never encountered such a situation since I switched from C to C++ 19 years ago.)

Leave a Reply

Your email address will not be published. Required fields are marked *