4 Ways to Troubleshoot that will Make You Fall in Love with Coding All Over Again
Two weeks ago, while working on a client website, I refreshed a newly updated page and lo and behold, it was all gone. Actually, it was still there but all of my styling was gone. Weirdly enough, my styling commands were still working on half of the site, while the other half was a total mess. A week later, I refreshed yet another client page to see absolutely no content on the page! I knew there was content on that page but for some reason it just wouldn’t show up!
When I was first starting out on my dev journey, moments like these would bring me close to tears. I would try anything and everything to get my code to work again, typing in random commands or deleting whole pages and starting again from scratch. To say I was endlessly frustrated is an understatement. So when you feel like you’re going in circles, you want to pull your hair out, your client will likely murder you, or like you’ve tried every trick in the book to no avail, take a few minutes and try these tricks because I PROMISE you’ll be able to figure it out much more efficiently and quickly if you do.
1. Make a List
Two weeks ago, when I temporarily broke my client’s website, my non-dev girlfriend told me to just “figure out what you did wrong.” So. Helpful.
But that got me thinking, if I could track the changes* I made, maybe it would be easier for me to narrow in on the right sections of code so I could find the problem faster. When I got to the third item on the list, I remembered I had just written in a new media query and maybe, just MAYBE, I had forgotten to add in an extra bracket at the end. I ran to my computer, jumped into my code, and just as I thought, no bracket. *cue the huge sigh of relief*
*if you’re using Github, they have a very helpful history tracker that works the same way! Otherwise, pen and paper work just as well.
2. Retrace your Steps (using your handy dandy list of recent updates)
We won’t always have lightbulb moments when we’re making a list of our coding history, hence #2: retrace your steps. Now that you have a roadmap of the changes you made, go through your code and ONLY look at those changes you made. This will help your eyes stay focused, help maintain your attention, and keep you more calm than trying to read through hundreds of lines of code.
4. Use your Helpline
At the beginning of the year, a designer friend of mine sent through a flurry of messages to me when she accidentally broke the styling code of her latest build. Thankfully, Squarespace will notify you if there is an issue. Unfortunately, Squarespace doesn’t note where the issue is. So after an hour of trying to find where she had missed a “;” or a “}”, she asked if I could help.
It took me maybe 5 minutes to scan through her code and find the missing bracket and update the stylesheet. It’s not because I’m ~such a pro~ but because I approached the problem from a totally different context. I had fresh eyes, wasn’t feeling stressed, and could take a few beats to think through the issue without worrying about how my client would react when they logged on to a jumbled site.
If you’ve been looking through your code to no avail, reach out to a friend or coworker and ask for their help, their eyes, or their advice on how to fix your problem.
4. Step Away
I know this is a hard one. You might be thinking, “BUT MY CLIENT!” “I CAN’T LEAVE IT LIKE THIS!!” Now, I’m not saying you have to step away for days and leave your client sweating and reconsidering their last payment to you. No, no, no. Take an hour, go for a short walk, sleep on it if you can. Whatever you decide to do, just take at least 20 minutes to stop thinking and stressing about your code. Recenter yourself and clear your mind so you can come back to the problem feeling energized, focused, and ready to get shit done.
So many times after I’ve spent hours trying to make code work and then forced myself to just sleep on it. More often than not I’ve been able to log on again and find and fix my mistakes in under 10 minutes.
Now shoo! Go take a break! Seriously, just 5 minutes. C’mon you can do it!
**And if you’re really at your wit’s end, send me a message! Teamwork makes the dreamwork, amirite?**