Thou shalt have no unbreakable programming principle
About the unbreakable programming principles
They’re everywhere and there are all kinds of it. You can pick whatever principle you’re most comfortable with, and stick to it …
NO!! Programming principles are attempts of generalization, or extracting “rules of thumb” from the already quite big collective experience of all things programming, but they’re NOT absolute truths or dogmas you have to stick to no matter what. If you can easily find programming principles that contradict each other, and you do, that means they follow some kind of …
The Gödel theorem applied to programing.
This is how it reads one of the most famous assertion of Gödel about math world (taken from wikipedia):
The second incompleteness theorem, an extension of the first, shows that the system cannot demonstrate its own consistency.
In “plain english” that says that, given a math corpus that arises from some set of axioms (an axiom being some assumption with has no proof, like the parallel postulate), on the statements that are part of this math corpus you could find a statement and its negation provable from the axioms. Let’s teak a leap of faith here and roughly translate to the world of programming to say that:
You can find two programming principles such as one is the negation of the other.
(Gotta say I just invented that quote)
Don’t sweat it
So, what? that’s precisely my point. It doesn’t matter! It only means the following:
There are no programming principle, “to die for”. If you find yourself going through a lot of hoops just because you’re trying to follow some of these “sacred” programming principles, maybe that programming principle is not that “sacred” on the first place and you have to “bend it” a little
The bad & Good News
Are the same:
Beauty in a code is just like beauty on anything else (paintings, books, physical formulae, music …). There’s no rule of how to achieve it. You just know it when it’s there.
(Oh boy, I’m full of quotes today). Programming principles are just guidelines that help us get there, but to achieve the beauty depends solely on us, not on us “following blindly” some principles. I guess there will be geniuses who achieve extreme beauty like in any other craft/art form, but “plain beauty” is achievable by all of us, but it’s not some checklist that will tell us how to achieve the “perfect” code. I’m afraid it’s the same as a writer, a painter, a musician: it’s just trial and error it’s “our eye”.
Where to place the effort?
In being happy with what we wrote, and rewriting it until we are happy with it and we find it with some “minimum beauty”. That will probably be a combination of good programming principles, symmetry, balance and something you can’t name …