People can ignore convention or not be aware of it, the structural constraints on the code are on the other hand far more discoverable and automatically enforceable.
Structure sometimes can be too rigid though
in the spirit of 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);
}
…
}