Michael Chrupcala

Get unstuck with this simple 4-step checklist.

Your leg started to cramp ten minutes ago, but you barely noticed.

The chatter from a distant TV is nothing but background noise — white noise, a gentle reminder of the outside world.

Your only focus is the sound from the strokes of your keyboard…click click click….a rapid-fire staccato of instructions to your machine. Create Object….insert method…the moment of truth when you test the lines you’ve just added…….Success! Great, and now you just have to add that one last function…console.log….run………broken! What!! Which line??

Writing code, no matter how much experience you have with it, is like walking on a tightrope. You’re perfectly balanced, standing on your knowledge of the language and the degree to which you can build a creative solution in your mind to a problem. To your left, and to your right, is nothing — just a broken program and an error message. When you stumble (and it happens to all of us), some errors are more helpful than others at pointing you toward the mistake. Often enough, one obvious re-write will get your program back up-and-running.

But what happens when you’re stuck? Completely at a loss, and staring at 200+lines of computer-speak that seemed very familiar to you just a second ago, and very unfamiliar in an instant. How do you work your way out, while keeping both the changes and the new lines that you just added?

Obvious? Sure, but I’ve noticed that 98% of my mistakes come from a misplaced comma or a misspelled “this”. Code is a fickle, unforgiving tool, and one extra letter or missing syntax can break the entire file.

The good news is, most IDE’s will come with features to help you catch errors faster. Personally I love all of the following: auto-complete, error detection, and color-coding. That last one’s my favorite because it means I can skim through a bunch of orange text strings and notice that little red stinker with the missing quotation mark. But if that didn’t work, ask yourself…

Me, for 2 hours, trying to find the extra “.” in my code.

It can feel really frustrating when your confidence is dashed by a bright red ‘ERROR’ across the screen. But you knew enough to get yourself here, and that means you probably know enough to get yourself out! So first, you should pick apart the error message and take a mental note of what’s familiar.

“Syntax error…I’ve seen this before, and the last time it was just a typo.”

“Null value….well I know that means that some value is either undefined or it doesn’t exist. Oh, and I also know that it’s probably considered ‘false’.”

Another thing you can try is, if you added more than a few lines of code, then try isolating them and reading slowly line-by-line. Explain to yourself what each of the lines should be doing, or read each word after word and remind yourself of the definitions. Maybe you forgot the “OR” operator, or you missed a constructor for your object. Which leads me to the next step…

Here, it could be really helpful to make a list of what you’re not familiar with. Do you have an idea of which line of code is the problem? If not, check the error message again to isolate the problem. Is there a new word in the error message that you haven’t seen before? Are you practicing a new concept, one that’s complicated and might be interacting with your code in a way that you wouldn’t expect? If that’s the case then you might need to…

This is, hands-down, my favorite part of coding. Every day you might face a new challenge, and every day that challenge can be an opportunity for growth. The amount of resources available online for computer programming is staggering. From articles that break down highly-specific edge cases, all the way up to complete Ivy League courses. Try not to feel discouraged when you run into a new term/concept- programming languages are massive, and this could happen every day! Instead, try seeing it as an invitation to go down the research rabbit hole. You never know which doors your curiosity could open.

It’s rare, and especially rare at the beginning of your career, for you to have a problem that nobody’s ever grappled with. There are more than seven billion people on this planet- that’s a lot of devs!

At this stage I like to get creative with my Google searches. Say I’m writing in JavaScript and I’m uncomfortable with ‘closure’ (and you’re not asking my ex). Searching the phrase “Javascript closure” is a good start, but “stackoverflow closure” will give me pages full of community-answered code examples, “r/javascript closure” will include 10+ posts on a wildly popular Reddit community, and that’s not even the tip of the iceberg. If the first few walkthroughs that you find are dry or poorly explained, then there’s no limit to the amount of information you’ll find online.

No matter where you’re at with your professional development, and no matter what you’re working on, the best thing you can do is keep going. Even if you went through all these steps and you’re still stuck, taking a 5-minute walk outside can usually break down that nasty roadblock. And we haven’t even talked about the stress-management and emotional awareness you’ll want to develop — especially those of you who are working on long-term products or growing businesses. But that’s for another article, another day.



SOURCE

LEAVE A REPLY

Please enter your comment!
Please enter your name here