I write Dumb/Disposable code
Glenn Puchtel
Principal Software Engineer/Architect | .Net | Azure | DevOps | FinOps | IaaS | PaaS | SaaS | FaaS | AGI (Unconventional Intelligence) | Biocybernetics | Author (book, newsletter) | Prompt Engineer (LLMs)
"Every line of code is written without reason, maintained out of weakness, and deleted by chance." Jean-Paul Sartre's Programming in ANSI C.
I strive to write dumb code. Or, at least, easily disposable. Easily disposable code has no or minimal dependencies—coupling. The most destructive force in software is tightly coupled code. Most, if not all, so-called design principles exist to mitigate it. While many are proposed, perhaps one principle is adequate: Write Dumb/Disposable Code (WDC).
Code that is easily disposable is loosely coupled and more easily refactored—a necessary act of strength for code health, where deletions are by choice, not chance—when code is easy to reason about. Excellent, but software must do something to be interesting; it must alter some essential dependency.
Dependencies are intrinsic or extrinsic. But this distinction is irrelevant; what's key is whether they are proper. While tightly coupled code is bad, improper dependencies are pure evil; they lurk in code not directly related to altering software's essential dependency.
Improper dependencies arise when we fail to see that in software, things belong on one of two piles: 1) things responsible for behavior and 2) things responsible for structure—things that mutate state and things that don't. Mixing these two is almost always a bad idea and pure evil—a recipe for coupling.
领英推荐
While blasphemous to disciples of the DRY (Don't Repeat Yourself) principle (which includes me), it, more than any other principle, is guilty of introducing such recipes—it is okay to repeat yourself to avoid an improper dependency.
"Smart data structures and dumb code works a lot better than the other way around" Eric s. Raymond.
For more rants, check out my article, "Software is Evil."
Staff Software Engineer at GRUBBRR
1 年Good rant! :)