Is your code universalizable?

I come from a family that hung on every word spoken by a politician named René Dumont, whose name will mean nothing to most of you.
An agricultural engineer, René Dumont spoke of ecology at a time when the word wasn’t in common use. In other words, he was preaching to the wind. In the 1974 presidential election, his candidacy garnered a grand total of 1.3% of the votes cast, with provocative slogans such as “Cars stink, pollute, and make you stupid”…
I have made these values my own, just as I have embraced radicalism.
What does this have to do with programming and software quality?
The connection is Kantian universality: “Act in such a way that the maxim of your action could be elevated by your will to a universal law.”
This single principle is the foundation of both ecology and software quality:
-
Flying four times a year is clearly not universalizable: if the 8 billion people currently alive did the same, global warming would be so severe that you wouldn’t be able to read the end of this sentence. The question that follows is therefore: why do we do it, despite all rationality? (Editor’s note: because of human psychology, modeled by the prisoner’s dilemma).
-
Writing 600 lines of code haphazardly, without testing, naming variables
toto,titi, andtata(yes, naming is complicated), and mixing 95 responsibilities spanning 3 contexts—that’s not any more generalizable: if all developers worked this way, it would be impossible to evolve even the smallest piece of code because it would cause so many regressions. In other words, this code would be disposable.
These two fields actually converge whenever we discuss digital frugality—and more specifically, eco-design for the Web. On this topic, I recommend reading the guide to 115 best practices developed by the GreenIT collective. There’s also a lot to be said about algorithm optimization, given how common naive and resource-hungry implementations are. Fellow developers, please take the time to study Big-O notation.
To tell the truth, I’m bringing up this subject only to set it aside. Because my point, before that, was indeed to highlight the common roots of environmentalism and software quality: a shared ethic and set of values. So much so that one cannot imagine a developer producing a little gem of code—perfectly architected, perfectly readable, perfectly tested—while driving a Hummer at the same time: that would be irrational. The only explanation would be a lack of information. But you’ll agree with me that in 2024, it’s no longer possible to be naive about any of these topics.
In fact, the parallel doesn’t stop there: technical debt echoes ecological debt (in both cases, a cost is passed on to future generations), just as the concept of negative externalities applies in both fields (bad code, like pollution, imposes a cost on those who didn’t produce it), not to mention sustainability (XP’s “sustainable pace” vs. sustainable development).
Ecology and software quality both hinge on the same test: “What if everyone did as I do?” Behavior that fails this test imposes a cost on others. No one can ignore that.