Essentially, it is the practice of anticipating all possible ways that an end-user could misuse a device, and designing the device so as to make such misuse impossible, or to minimize the negative consequences.
Power sockets are often keyed in such a manner, to prevent the transposition of live and neutral.
They are also recessed in the wall in a way that makes it impossible to touch connectors once they become live.
Murphy's law is a well-known statement of the need for defensive design, and also of its ultimate limitations.
Accompanying circuitry makes the plugs and cables behave as though they are symmetric.