1. 2

Not the original title I gave it, but I thought that one was potentially to clickbaity for people not familiar with the source quote, so I changed it.

Overall it’s just a bunch of thoughts trying to explore the subject of naming variables, not sure if anything is useful or original, but I hope at least some of the questions I raise serve as a bit of inspiration.

  1.  

  2. 4

    It’s interesting to me that that of the three examples:

    function clac_quarterly_interest(principal, rate, quarters):
        return principal*rate*time
    
    function claculate_quarterly_interest(principal, rate, quarters):
        quarterly_returns = multiply(principal, rate)
        return multiply(quarterly_returns, time)
    

    and

    i(p,r,q)=p*r*q
    

    Only the last one is the one with no glaring errors: the other two use nonexistent variables, and both calculate and its abbreviation are misspelled.

    1. 2

      It seems that there is some sort of an axiom or theorem emerging:

      Every article about variable naming must begin with that Phil Karlton’s quote

      “ There are only two hard things in Computer Science: cache invalidation and naming things. — Phil Karlton “

      [1] https://hackernoon.com/the-art-of-naming-variables-52f44de00aad

      1. 2

        I always heard the quote as “There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.”