People can ignore conventions or not be aware of them. On the other hand, structural constraints in the code are far more discoverable and automatically enforceable.
It's usually easy to get your tools to tell you what you're doing wrong and how you can fix it.
Arguably it's another view on knowledge in the world vs knowledge in the head
Structure sometimes can be too rigid though
in the spirit of the example below - think all the classes in java throwing "not implemented" error.
public class MoogDiver {
Gradient gradient;
List<Spline> splines;
public void dive(String reason) {
saturateGradient();
reticulateSplines();
diveForMoog(reason);
}
…
}
reticulateSplines
before saturateGradient was called, leading to an UnsaturatedGradientException
. A better solution is: public class MoogDiver {
Gradient gradient;
List<Spline> splines;
public void dive(String reason) {
Gradient gradient = saturateGradient();
List<Spline> splines = reticulateSplines(gradient);
diveForMoog(splines, reason);
}
…
}