14
5 Comments

DRY your code, but RIG your cognition

From Donald Norman's The Design of Everyday Things (I've rearranged the order of paragraphs for clarity):

Today, we insist that people perform abnormally, to adapt themselves to the peculiar demands of machines, which includes always giving precise, accurate information.

People are not machines. Machines don't have to deal with continual interruptions. People are subjected to continual interruptions. As a result, we are often bouncing back and forth between tasks, having to recover our place, what we were doing, and what we were thinking when we return to a previous task. No wonder we sometimes forget our place when we return to the original task, either skipping or repeating a step, or imprecisely retaining the information we were about to enter.

Eliminate the term human error. Instead, talk about communication and interaction: what we call an error is usually bad communication or interaction.

What makes this credo on design especially profound is that it doesn't just apply to designing things for other people. It also applies to designing things for yourself, like a work routine or a reading program or even a high-level life philosophy. (Tellingly, the original title of Norman's book was The Psychology of Everyday Things.)

In general, good software engineers follow the "don't repeat yourself" (DRY) principle when writing code. But as the credo points out, humans aren't code. We're a different kind of system with a different set of rules. So I propose a new principle for designing environments for people: the "repetition is good" (RIG) principle.

DRY code. RIG cognition.

Here's an example I'd classify under "performance design." When I really care to wake up on time, I use three separate alarm clocks. The first is my smartwatch, which merely vibrates at my wake-up time. If that fails to get me up, my smartphone plays a song on the windowsill by the bed one minute following my wake-up time. Which kind of sucks. Because my girlfriend sleeps next to me, and the song might wake her up. Lastly, the final alarm, which sits on the floor outside my bedroom and goes off two minutes following my wake-up time, is a Clocky alarm: an obnoxiously loud wheeled device which literally darts in random directions. As you can imagine, that final alarm rarely goes off.


The Adjacent Possible is where I share my most useful insights in bite-sized posts. One email per week. Many insights per email:

Go here for more posts in the series.

  1. 2

    If you go to bed early you don't need an alarm clock!

    1. 1

      This is true. But also, Nighttime Channing doesn't like to follow rules...

  2. 2

    I would go further and say that even DRY might cause harm to your code.

    You wrote a piece of code, extracted a function, and reused it in two places. And now, one place requires changes impacting the extracted function. You start adding parameters and switches to it. You might introduce more bugs and make the code more complex.

    So, yes, repeat the code easily. Imagine the same situation without extraction. Each piece of code, while similar to others, is simple and independent. When you change the extracted function, you are not worried about its impact because there is no common code anymore.

    RIG!

  3. 2

    Repetition is certainly essential for people to achieve mastery in any area of knowledge, craft, or skill, including coding. Being able to DRY your code is probably a result of RIGging your cognition on the way to mastery.

    Awesome post!!

  4. 1

    This is an interesting perspective on the importance of repetition in designing environments for people. The idea of using multiple alarms to wake up on time is a good example of the RIG principle in action. By setting multiple alarms, you're creating a system of repetition that makes it more likely that you'll wake up when you want to. This is similar to the way that repeating code can make it more reliable and easier to understand. Of course, this approach may not work for everyone, and it's important to find the right balance between repetition and variety in your own life. But the RIG principle is a useful reminder that repetition can be a valuable tool for achieving your goals.

Trending on Indie Hackers
Passed $7k 💵 in a month with my boring directory of job boards 57 comments How I got 1,000+ sign-ups in less than a month with social media alone 22 comments 87.7% of entrepreneurs struggle with at least one mental health issue 14 comments Are you wondering how to gain subscribers to a founder's X account from scratch? 9 comments Indie hackers selling to indie hackers? 7 comments Story of Iconbuddy from $0 to $6k per month in last 9 months 6 comments