Maybe I’m just obtuse, but whenever I read an article from a company, or programmer, or really anyone talking about “best practices”, it always seems like the examples are either obvious, and therefore un-illustrative of best-practices, or non-specific, and difficult to tell if the best-practices actually solve for the problem.
Best practices seem to range across three general categories:
- Common: Practices to prevent mistakes that are very human, and very common, regardless of how experienced or “good” you are.
- Training Wheels: Practices to prevent mistakes for the lowest common denominator, and not very common, but are good ideas for you if you are the lowest common denominator, or adjacent to them.
- Checking: Practices that prevent mistakes that are some combination of rare in probability, easy to imagine, hard to do, but dire in their consequences.
The first category (Common) is the good one. The second one (Training Wheels) is the okay one, but it’s a hard sell. No one wants to be told that they’re the reason the rule exists, and everyone is generally trying to not be the rule.
The third one (Checking) is the one that’s most written about because it’s fun to tell the story of the Big Bad Wolf. A bad thing can happen, so you’d better prevent it. They’re also fairly interesting and informative to hear about. This is the one that shouldn’t be a practice so much as something written into software; either in code or in culture. Ideally both.
It’s hard because doing things right or doing good work relies on some combination of professional and domain expertise that can be learned, but doesn’t necessarily need to be experienced. You often can’t reason your way from first-principles all the way to where you need to be. Partly because it takes a lot of reason to get there, and but mostly because it takes a lot of time to do that reasoning.
You learn from getting burned, but we could do with programmers that have fewer burn scars.
Anyways, this is a long way of saying that answers on StackOverflow that say “you should never do X, because it’s bad practice to do X” are maddening, and uninformative.