This is called intentional programming. You write code for the intentional control flow path which you expect the code to take. And you don’t write any code for the paths which you think are not possible. Furthermore, you don’t write code for data flow which was not the intention of the program.
This article about intentional programming was mind expanding and eye-opening for me. Yes, it hurt. But in a good way. It talks about the way Erlang handles errors in a way that eliminates the need to be a defensive coder and anticipate all possible fault scenarios. Smart programming.