As it does with everyone who’s new to anything, it happens regularly with me. Throughout my first three weeks at Flatiron School’s Software Engineering program, my code doesn’t work.
It’s okay. Deep breath. Read the error. Ok, I think I see the problem. Frantic typing and editing. Run the file, error. Okay… deep breath. Read the error, same error as before. Command-z your changes. Try again, run, error. Deep breath. Try again, error, try again, error, try again, error.
I tend to be on the stubborn side, and most of my professional career, I’ve been able to “brute force” any problem that’s arisen. More time, more effort, solution. As I start this new path into coding, I’m learning this is not a very successful approach. I have had times where I continue to throw whatever I can against the wall, just to run into more errors.
This has led to more frustrations than I can count, and drifting into what I’ve heard referred to as the “Panic Zone”. I’ve been adapting (sometimes not as quickly as I’d like) and developed some strategies that help me through these points. Hopefully they can help you as well.
- Deep Breath
It sounds simple, but I tend to spiral pretty quickly when I run across a particularly nasty bug. This leads to a “throw it all at the wall and see what sticks” mentality that is not effective. Take a second, and slow down. I was taught a valuable lesson early in my career, and the sign hung on every office I’ve had since then. “Slow means smooth, smooth means fast”. Take a beat, impulse will say attack it fast so you can move on. Fight that urge. Find out why your code is failing, then resolve. This leads right into the next
2. Read the actual error
For the uninitiated and new, the below code fail can seem daunting:
While building out an early project, I noticed our errors would get longer and longer, which viscerally is scary. One thing I had to keep telling myself: “This does not mean you are failing on a larger scale!”. An error is always something that can be resolved, whether thats fixing code already written or trying it from a different perspective. Back to the big scary error above, looking through the error and my code side-by-side, all this information being processed ended up being a simple typo in my code. I repeat, it doesn’t mean you failed in a spectacular manner. Read the error with a calm head, and the solution will hopefully make itself known.
3. Take a break
Ok, so you’ve taken your breath, read your error, its not working. You’ve tried to rewrite your code, it errors out. You tried changing variables, it errors out. You’ve tried every debugging tool you’ve learned to this point, errors. My last piece seems counter-intuitive.
Take 10 minutes and do literally anything else. Scroll Instagram, flip on the TV, take a walk around the block, get some water. Anything that does not involve sitting in front of your code and staring at it. Sometimes just the simple act of walking away for just a little bit enables you to see the forest through the trees, as it were.
For me, every process starts with the above 3 steps. If I can get to a solution with them, great, moving right along. If I can’t, then I look into what further resources I have. In my short time in both the Flatiron community and the coder community as a whole, I’ve noticed how helpful people are when they hit these bugs. At the core, anyone thats sat in front of non-working code knows exactly the frustration you are going through, they challenges, the frustration, the creeping Imposter Syndrome that follows. Check with other coders, check online forums. If you’re in an academic setting like Flatiron, check with your classmates and instructors. People want to help, just let them know.
As a beginner in anything, it’s easy to fall into a frustration spiral, I struggle with it every day. And sometimes it’s hard not to recognize when you’re going down a bad road mentally when your code isn’t going your way. Find the thing that keeps you in the right frame of mind. If its physical, write a note and stick it to your wall in your area. If it’s mental, keep it front of mind as you work. I’m a firm believer in the saying “It’s not stupid if it works”, and that “if it works” is different for everyone. Find yours.