Skip to content

ZeroSuperfluousNames

John Qase Hacker edited this page Aug 31, 2015 · 3 revisions

Here's a dumb, but illustrative example. You have a function factorial_1() that returns the value of the first factorial. You have another one, called factorial_2() that returns the second. And a third, factorial_7().

ZeroSuperfluousNames means to put that mostly duplicate code into a single function: factorial(n).

But there's another interpretation of this directive: proper use of symbols vs. names. Visually, in your code a symbol is distinct, so your language should maximize this feature so that identifiers are completely distinguishable from your operators. Make common and meta operations into succinct symbols, like I/O operators, clone-object, and query-state.

Math does this perfectly -- there's no confusion to what is a number and what is a symbol, even though they are both drawn in the same color on the page. Your mind lexes this "code" better and easier by the definition and utilization of these symbols.

As another example, Python uses the word "self" for referencing the object within class methods, yet there's nothing to distinguish this very special usage from any other identifier. A symbol like &, or @, would better, or even nothing at all, but an empty dot operator plus the method name.

Clone this wiki locally