3 ms·
In the vein of goto, premature optimization, clean code, testing, etc... I think most programming dogmas -- sans of K.I.S.S/write the least amount of code that
by financltravsty 3y ago
In the vein of goto, premature optimization, clean code, testing, etc... I think most programming dogmas -- sans of K.I.S.S/write the least amount of code that fulfills all the requirements -- is incorrect, in that it shouldn't be applied haphazardly, without first giving some thought about your unique circumstances.
I've found it better to develop an intuition for these sorts of things, by making mistakes (or seeing those of others), and going from there. In the case of goto, as the author mentions, it really isn't implemented in modern languages the way it used to be (i.e. goto anywhere in the program). But sometimes it is necessary (e.g. early exit a try-catch block, jumping to an error-handling & cleanup block in gruesome circumstances, breaking out of deeply nested loops (never having deeply nested loops is another dogma I don't agree with), in state machines, etc.).