Trench warfare has often been used in defense. Entrenched soldiers can be somewhat safe from enemy fire. Trench warfare made World War I longer than expected. The trench coat got its name from there.
Several kinds of trench exist:
Utility trench has pipes, wires, or other infrastructure