I Can’t Overstate This Enough
Hardly a new sentiment, but I personally will never not need this exhortation to KISS.
And to be clear, when I talk about keeping things simple ( particularly in production code), I will forever mean to keep things conceptually simple. The price of minimalistic elegance can be high and not everyone on your team has paid that price (of advanced language features or category theoretical concepts). In addition to the price of learning that you have personally paid over the years, there is an added you paid while writing the code of your own immediate attention and concentration. Sadly, when you revisit this code, you will need to pay a a good bit of that price again.
The largest downside to the fact that our industry is made up of so many engineers who are learning as they go, is that they express their newfound knowledge in code that others may have to work with for years and don’t understand the cost they are incurring for others.
Just as medical students, apparently, go through a phase where they are convinced they have a rare, likely fatal disease, so do intermediate engineers think that the newest (and valuable!) lesson that they have learned is directly applicable to the likely more mundane task at hand.
Of course, this is where code review comes in. And that is the role of the more senior engineers. Insisting that the conditional assignment of two nearly identical strings is preferable to a function that can generate those strings. (Hint: When debugging, the strings are searchable and more readable than a three line function that’s located somewhere else in the code and has to be interpreted)
Ours is a young industry still and is absolutely much more of a craftsman-based profession than most realize. I read somewhere that it is closer to what civil engineering was like as of the 19th century, where there were still self-taught engineers and very few measurable or verifiable standards. That seems about right to me.