3 inequalities for good code 👌

There there are many articles on the Dos and Don’ts of writing good code. I think writing good code is not always that black and white.

That’s why today, we focus on some principles that prove to be true often, but maybe not always. We express these principles as inequalities, to show that behaviour A should be used more often than behaviour B, while still allowing for behaviour B to be used more often, than we would use a rare exception.

Explicit > Implicit

Make explicit what you do. Examples for this include to write comments, document functions, and use the argument’s name when calling a function. Also, consider declaring datatypes for objects and arguments explicitly, such that everyone knows what to expect.

Pen & Paper > Mouse & Keyboard

Plan what you are going to do on a sheet of paper. Pen & Paper beat “trying it out” in your code editor almost always.

Flexible > Rigid

Keep it flexible. Pull out magick numbers from your code and set them at a specific location in your script. Write functions, get dimensions from existing objects, and turn your code into a package or module. The more flexible your code, the more adaptable it is. The more adaptable your code, the more people could use it.


Reply to this email and tell me about your inequalities for good code!