How many times have I heard someone exclaim, “But why did they do it like that?!” when referring to the code or architecture produced by another team? And how many times have I said it myself?
This kind of remark can be madeāmore or less grumpilyāin two scenarios:
Whenever I catch myself falling into one of these two scenarios, I make an effort to metaphorically slap my own fingers to remind myself to temperāat least a littleāmy judgment.
The first question to ask is:
A practice is a set of conventions or ways of doing things shared by a community, such as a development team or a company.
A practice only becomes good when it has repeatedly proven its effectiveness. The question, then, is to determine against what criteria we judge its effectiveness.
A good practice is not absolute. It can be summarized as a well-regarded, effective approach applied at the intersection of:
All these elements are nothing more than working hypotheses. And the nature of a hypothesis is that it can be invalidatedāeither immediately (as is often the case with POCs, for example) or later on.
The time dimension is central in two ways:
The challenge here is that we cannot predict the futureāwe must make choices knowing that time may prove us wrong. However, we are very good at analyzing the past and observing the present. And this is precisely where presentism starts to creep in.
We may be tempted to judge a solution today based on what we know (or believe we knowā¦) about the past and present, rather than on what was known or imagined at the time.
Every time we facepalm and curse at someone else’s code or solution, we should instead ask ourselves:
These simple questions help avoid the trap of presentism or hindsight bias, which involves judging past decisions through the lens of current knowledge. But then, how can we be sure we understand the assumptions originally made?
Documenting decisions generally helps. In the context of software development, one way to address this issue is by writing Architecture Decision Records (ADR). These records archive technical decisions, the context in which they were made, and the alternatives that were considered. ADRs help contextualize and understand past choices, making solution maintenance easier.
Now, if ADRs effectively meet a need (documenting past decisions), in a specific context (software development), and with a clear optimization goal (maximizing maintainability), am I not, in fact, saying that ADRs are⦠a good practice? š¬
Ultimately, deciding whether to apply a particular practice is fundamentally a bet on the future, highly dependent on the context. A bet that seems relatively safe given current assumptions and past experiencesābut a bet nonetheless.