Have you ever made a silly programming mistake?
No? Are you a bot?!?
Yes? Phew, you’re in the right place.
Name a silly mistake, and I’ve probably made it.
I’ve forgotten to save the file I was working on before trying to test the code change I made. I’ve forgotten to change all of the names when I’ve renamed a variable only to get an error for the one I missed. I’ve forgotten semicolons, ends, and other important syntax, causing build errors and apps to crash and making me feel like I broke everything. I’ve made typos causing me to tear my hair out in confusion as to why something was not working. I’ve written
= instead of
== (oops!) causing data to save incorrectly. I’ve made server-side changes and then forgotten to restart my server.
And finally, my favorite mistake of all: testing something in the wrong environment! I’ve tried to test changes I made in my dev environment, only to realize I was refreshing production instead. I’ve tested something in a sandbox or staging environment when, in fact, I did not deploy those changes to those environments. The list goes on and on; there are countless silly mistakes to be made in programming.
What about you? How have you felt after you’ve made a silly mistake like that? Have you been angry or frustrated with yourself? I know I have! Especially when it’s taken me a long time to figure out what the mistake was. The temptation can be to want to throw your computer out the window.
I know this, and I’ve been there, but I’m here to help you change your mindset.
Introducing the Silly Mistake Principle
This principle is all about mindset. It’s incredibly simple, but can be very powerful.
When you make a silly mistake, instead of being overcome with frustration, take a second to reframe the situation (and sometimes a deep breath), and be glad it was a silly mistake! If what you were debugging wasn’t caused by a silly mistake, it wouldn’t have been so easy to fix. You would still be trying to figure out why your data wasn’t saving properly or your styles weren’t updating, rather than moving onto the next task.
After discovering that you made a silly mistake is the worst time to be frustrated, because it may prevent you from wanting to move forward on your work at the very moment that you’ve become unblocked. I was once trying to finish an important project and was stuck on a bug for over an hour. I spent time being mad at myself for making the mistake, rather than doing the fun part: launching my feature. Now, that was the real silly mistake!
How To Prevent Silly Mistakes
Though changing your mindset is one step in the right direction, you should still strive to prevent repeating the same silly mistakes and learn from each one. Here are a few additional actionable measures you can take to prevent your future self from making these types of mistakes:
One of the tools I use daily is Evernote, but any note taking app will work. I have one sheet in Evernote where I keep track of how to fix weird errors when I encounter them. This note includes everything from startup commands I need when I update my computer or it randomly restarts and I need to get my dev environment up and running again to full instructions for what to do when I encounter a certain error in part of the stack. I’ve found this personal record to be a lifesaver at times when I’ve needed to reference it - it can also be much faster than googling the same error or question repeatedly.
In terms of silly mistakes, this technique can also be useful. For example, let’s say that everytime you make a silly mistake, you take note of it somewhere. Then, when you get stuck on something, you can quickly reference this list of mistakes to see if one on your list is the culprit for your current issue. It’s as if you’re creating a silly mistake checklist! Hopefully, over time, this trick will help you make fewer silly mistakes (just as, say, when I encounter a familiar error, I know exactly what command I need to fix it and where it is in my note of frequently used commands). However, I would still recommend starting to keep track of which mistakes you make more than once, and then sort them by most frequent. By doing this, you will have a bit more awareness around your top mistakes as they will be the first things you check for when you’re stuck, and again, hopefully over time, you will make them less and less.
Another way to prevent silly mistakes, especially syntactical errors, is to automate the checking of these. You can use a linter, or set up your editor in other ways to catch errors. These types of automation will ensure that your code doesn’t make it very far without getting cleaned up. (For compiled languages, many of these types of checks are built in at compile time.)
What to do when you’re stuck, silly mistake or not
If you’re stuck on a problem, whether or not it’s due to a silly mistake, remember to first timebox it. Give yourself a limited amount of time to search for and try different solutions, and keep track of everything that you’ve tried so that you can easily step away and come back to it again right where you left off. Once the time you’ve set for yourself is up, make sure to actually take a break. Sometimes just stepping away from your desk for 5 minutes can make all the difference. Walk around your office or go for a walk outside!
Another technique you can try is to context switch. If there is another small task you are working on or a bug you’ve been wanting to fix, take some time to look into that before coming back to your original problem. Though I don’t recommend context switching too frequently because it can become very draining, sometimes a context switch can give you added insight and help you have fresh eyes when you come back to the original problem you were trying to solve.
Finally, if you’ve tried these techniques, but you’re still stuck, it’s time to ask for help. Sometimes this is just asking another developer for a second pair of eyes on some code. Often, another person will quickly be able to spot a mistake that you missed or glossed over.
So, next time you make a silly mistake and are about to get frustrated, remember The Silly Mistake Principle and, instead of getting frustrated, note your mistake so you can learn from it, and tackle what’s next!
Have you ever made a silly programming mistake? What was it, and how did you handle it? Has The Silly Mistake Principle helped you change your mindset? Let me know by emailing me at email@example.com.