DEV Community

Discussion on: Is “Defensive Programming” actually healthy?

Collapse
 
faithfinder profile image
Dmitrii Kartashev

In this particular example, I would probably just make "stop" a fall-through case, so no matter what happens the movement doesn't start at the wrong time and call that a day. Globally, would depend on the real case, but I'd say you might want to include your reasoning in the code review from the beginning, and "you never know what might happen in the future" is not good enough. The better review would say exactly what kind of trouble you expect.