I apologize in advance for being blunt! And it’s not really as bad as the title suggests. But my point is that every decision you make, whether it’s about a small piece of isolated code or the architecture as a whole, may not stand the test of time. With the luxury of hindsight, you will almost always find at least some problem with a previous decision. And that’s completely natural! At the time a decision is made, it might be the best one considering the information that is available. Some time later, you’re in a position where you have hard evidence of the consequences of the decision and probably also more information. It’s also a fact that the truths (about technology, architectural patterns, etc.) of today are not necessarily the truths of tomorrow.
There are two key takeaways here:
- It’s so easy to study a system (or piece of software; the scale doesn’t matter here) made by someone else and criticize the decisions that lead to the current state of the system. You need to understand and appreciate the conditions under which these decisions were made!
- When making a decision, keep things simple! The KISS principle wins every time! Don’t make premature optimizations. Don’t create abstractions from single cases. Don’t build a castle when a cabin will do. Make it so that you can modify or complement the decision at a later time without earth-shattering consequences. Be agile!
As for the first point, a colleague reminded me that if the original decision maker still holds on to previous decisions without realizing (or wanting to realize) that they are out-of-date, you don’t need to be as humble!
I think that keeping a design rationale is sound, but I’ve never come around to actually do it. Mostly because I’ve wanted to avoid creating yet another document to live with the software (of course, a decision rationale is not “living” in the same sense as many other documents; it’s a history record). But perhaps a design rationale is overkill. Perhaps we should just accept that decisions are imperfect and whenever we’re in a position to make a superior decision, we should do so without dwelling on the past.
To end on a positive note, and to be fair, of the countless micro decisions you make on a day-to-day basis, a majority will most likely be good ones! To stay healthy and sane, I think you just need to be good at recognizing them!