0. Start from zero
Zero is the magic number. For everything. (Except Coke.)
For example, atomic numbers start at zero, not one. Hydrogen is bohring. Neutronium is much more fun. Be sure to deploy this fascinating nugget at length during pub quizzes and family meals and, in case no real people find it as fascinating or redefining as you do, in online forums.
The day begins at 00:00. Have no truck with the twelve-hour clock. It is a nonsense that demands unnecessary modulo arithmetic and flags.
Count your indexes from zero. If your programming language doesn’t support zero indexing, either change language or plough on regardless, ignoring any exceptions, undefined behaviour or program failures. You know you’re right. That’s all that matters.
1. The programmer is right
In any interaction, whether between programmer and manager or programmer and customer or programmer and computer, the default assumption should be that the programmer is right.
Unfortunately, not everyone seems to either know or appreciate this – the zeroth rule of Being Right Club is, after all, “You don’t talk about Being Right Club” – which gives rises to all those long discussions and disagreements and disciplinary hearings.
The real problem occurs when two programmers get together. They are both right. Even when they hold different truths. This apparent contradiction is found in the heart of quantum mechanics, thus giving programmers a unique, foundational and paradoxical position in the pecking order of the universe.
It has been said that managing programmers is like herding cats. Almost. It is more like herding Schrödinger’s cats.
01000110 01010100 01010111 00100001
Logic is a resource. It should, therefore, be applied sparingly. Of course, employ logic in code, but it doesn’t necessarily have to be used elsewhere (e.g., in life or dealings with colleagues). As with other resources, you don’t want to risk using it all up.
4. Information hiding
Fundamental to resilient and reasoned program structuring is the idea of information hiding. Keep secrets. Make sure your implementation is not obvious and your interface is inscrutably yet charmingly quirky. Such information hiding enhances security – especially job security.
It follows from the principle of information hiding that you shouldn’t share things. Avoidance of sharing simplifies not only multithreaded programming, but also means enforcing a strictly personal model of code ownership, a desk configuration antagonistic to pairing and a ring-fenced (and castellated and moated) spot in the office fridge.
Wasabi for your sushi, wabi-sabi for your code. Spice up your source with this Japanese aesthetic.
Instead of aiming for a purist view of perfection, wabi-sabi teaches us that a greater whole can be achieved through carefully placed imperfection, a recognition of impermanence and the essential completeness of incompleteness.
Embrace this philosophy in your code.
But why settle for subtle imperfections that enhance the whole? Move beyond the whole. Embrace imperfection more deeply and overtly. Clean code? Better with a splash of muddy logic. Abstract classes? Weigh them down with something concrete. A rich and healthy domain model? Introduce poverty with an underclass of malnourished, anaemic domain objects.
Flaunt impermanence. Comment your code with the fixes you’ve done or the fixes you think should be done. But don’t do them. Use this also to highlight the incompleteness of existence. Suggest the eternity of nature that subsumes our fleeting lives. Don’t finish things. Done done? Not even close.
Because The Martian.
7. Test your code
Do this by giving it to the customer. (If they ask nicely, compile it first.)
8. There are eight planets in the solar system
There is a sun, two groupings of planets, four terrestrial planets in the inner solar system and four gas giants in the outer solar system, giving a total of eight planets. This all conveniently aligns with powers of two, so therefore must be right. And there are patterns within: pow(2, 3) is 8 and Earth is the third planet. Coincidence? Of course not.
Don’t fall for the Disney conspiracy.
9. The secret to writing great code
Much has been written on what it means to write great code and how to write it. Most of it is wrong. There is only one thing you need to know: always–
Overload Journal #132 - April 2016 + Programming Topics
|Browse in :||
All > Topics > Programming (766)
Any of these categories - All of these categories