This is one of the most common words we hear in both software development and physical fitness. “Get your reps in!” said many coaches to me growing up.
Repetitions are key to learning new things. Repeating things over and over strengthens neural pathways. The word practicing, which is coupled with improvement, involves repeating concepts under controlled conditions.
In software development, however, repetition is frowned upon. If we have multiple ways of determining an answer, it causes problems when we inevitably have to update our solution. What if we miss one of the methods? What if they don’t all work the same way? Our common term is to keep your code DRY which stands for “Don’t Repeat Yourself”.
Sometimes repetition might exist in the code but not be as obvious to spot. Talking to clients I often say that the code is “Similar but not the same”. Our next steps are then to make the code the same so we can remove the duplication. This is one of many ways repetition or duplication can live inside our code.
Recently I found a new form of repetition in my code. I had two parts of a program that performed many of the same tasks. At first, I thought I needed to move the common code to a central location to remove the duplication. However, after I began working on it, a new idea emerged. Did the second part even need to duplicate these processes? Was there another, simpler way to solve the problem that removed the need to duplicate behaviour?
Humans by nature seems to make things more complicated. We should strive for simplicity.
A simpler solution had revealed itself. My software friends often remind me to “Do the simplest thing that could possibly work”. Perhaps I need to add this to my list of “things to consider while coding”. Ron Jeffries and others have written more about this rule: https://ronjeffries.com/xprog/articles/practices/pracsimplest/
Coming back to improvement, repetition is key principal. Practicing regularly can develop a habit. Good software teams have the habit of regularly practicing solving simple solutions in different ways.
Repetition is all around us. We love repeating a good story.
Repetition is also a key component of music composition. If you’ve ever hummed or whistled a tune, it’s probably a part that is repeated. Repetition also exists in writing, architecture, manufacturing and in nature. It’s everywhere!
“We keep repeating the same mistake until we figure out the solution.” ~Tim Ottinger
So repetition isn’t a good or bad thing. It is a pattern and it’s something that you can learn from if you pay attention to it. Do we need all these repeating meetings? Do we keep repeating instructions? Do I need to push for one more rep? Take a look at how repetition exists in your life. Do you want to change it?