Principles of Programming: The Wisdom of Being Neutral

An inexperienced programmer frequently tries to make every single thing as complex as his understanding allows him to make it. But he must not. If one makes things as complex as that, they will be unmaintainable, unenhanceable and too complex to use.
  • How complex is a screw?

    What does a single screw do? Does it hold books?

    No, but it can be used in a bookshelf that does.

  • How complex is a rivet?

    What does a single rivet do? Does it transport oil across oceans?

    No, but it can be used in an oil tanker that does.

  • How complex is a single lego block?

    Whatever does a single lego block do?
A single screw or a rivet or a lego do nothing special on their own. That's why they are so versatile: because they're neutral.

Everything one writes in code, every single function or component or class, needs to be neutral like that, too. Reusability of your code does not come from what it does. It comes from what it doesn't do. It comes from what it consciously avoids doing so as not to interfere or restrict the range of unexpected ways in which it can be used.

Comments

Popular posts from this blog

"Unreachable" beauty standards

When monospace fonts aren't: The Unicode character width nightmare

Is the internet ready for DMARC with p=reject?