DEV Community

Cover image for How to get Unstack in CODING?

How to get Unstack in CODING?

Fariha Rajput
Full-Stack web Developer | Design enthusiast! Currently venturing the world of Software Engineering.
・4 min read

Some code in my application is being underhanded and will not do as I advise it. Also, I just can't understand what might actually not be right! I've had this issue throughout recent days. Regardless of what I look like at it, I can't see an exit plan. I'm an obstinate individual, so I dive in profound and continue to worry about this issue until I alone arise triumphantly.

We've all attempted this. We've all had an issue that we attempted to tackle. We as a whole most likely both disdain and love these circumstances - I realize I do! Critical thinking is at the actual center of being a product designer.

So how would we do it? How would we consistently arise victoriously? I don't have a clue how you do it, however, I understand what I do. This article is about that.

Cannot read property 'XYZ's of undefined

First of all, I've put in some time learning the different kinds of error types my language has. For example, it pays off for me to know the difference between "cannot read x of undefined" and "unhandled exception".

I've taught myself to analyze the error messages I get in the console, search through my code where the error message suggests and look for something related to the error type.

An example!


The above code snippet is a middleware for something like Express or Restify. If I got the error


I understand what record to glance in and what line to take a gander at. Yet, I also realize that 'username' can't be perused because the thingy 'username' is stuck on (fields) is unclear. Presently I can start to criminal investigator out of the issue - by asking: "For what reason is 'fields' indistinct? What did I neglect to do?"

Realizing what the various types of blunder types mean has presumably been the main thing for me with regards to troubleshooting my code.

Console.log(all the things)

I've got a bunch of nested conditionals in my code and I am not getting the response I expected.

(console.log("here")) to the rescue!

I use this little debugging trick so much you might say it's my go-to solution. Move the (console.log()) around in your code. Notice where it pops up and where it doesn't.

It may appear to be imbecilic, yet you'd be amazed how frequently this straightforward little stunt helps (how's that for a tick badly title?).

"Yet, doesn't the IDE debugger as of now give you this usefulness?" you may inquire.

Indeed, yes. It does. Regularly, turning up the debugger just to know where my rationale falls flat in JavaScript is excessive, however.

That being said:

Befriend Your Debugging Tool

All the big IDEs and VS Code have debugging tools. How you use them differs a bit from IDE to IDE. But get to know yours. Learn about break-points, the call stack, jump in and jump over, and so on.

I often run an application in debugging mode when I develop. This lets me add break-points on the fly.

Take A Break!

For real! Do something else. Go for a walk, clear your mind. Work on a different problem in a different language. Help someone else with their coding problem. Whatever you do, do something that will distract you and take your mind off of your problem.

Some of you might think this is some hippie new-age advice. But it helps. I promise! There's even science to back this claim.


Elastic duck troubleshooting is something I practice strictly. It's a technique where you express your issue. Ideally, you do this to an elastic duck. The hypothesis behind this training is that when you need to depict an issue, the arrangement regularly introduces itself inside the portrayal. I do this a great deal with my understudies. So much, truth be told, that a portion of my understudies alludes to it as "being elastic dodged by Brian".

Figure out how To Search

Let's face it. Googling the answer for an issue is something we as a whole do. Or then again perhaps we DuckDuckGo it. Perhaps we just hunt on explicit stages like StackOverflow. Whatever the case is for you, figure out how to form the center of your concern. Use watchwords. PCs comprehend unhinged sentences, for example, "unclear mistake req. fields express" (reward: This very search query on DuckDuckGo has a body-parser issue recorded as the number 1 outcome, which, unexpectedly, is what's going on in my model).

Learn To Formulate The Problem

Asking a question on StackOverflow or similar communities can be a really great exercise. Why?

You train yourself in being clear You might help others with similar problems along the way You might realize the solution as you describe your issue (rubber duck debugging gone digital).


Seriously. There's no shame in asking for help. Know what you know. But more importantly; know when there is something you don't know. Use it as an opportunity to learn something new. Ask your friend, teacher, co-worker, the Almighty Google Overlord.

Practice pair-programming. My experience is that programming in pairs gives cause for great discussions about the 'why' in your code.

Don't Worry

Writing computer programs is hard. Writing computer programs is disappointing. Control your psyche to comprehend that disappointment is an opportunity to learn. We don't take in a single thing from being accepted at the same thing again and again. Set out to "move quick and break things" - just, as, not in a "we should make an application that can topple governments"- way.

We as a whole battle. Day by day even. It's alright, don't stress over it. It will not get any simpler, however, it will get significantly more fun as you learn and improve as a designer.

Presently it's the ideal opportunity for you to share your little tips and deceives for getting unstuck on a programming issue. Do you do any of the things I do?

Discussion (0)