
Hey.
Welcome to Coditate a wellness site for programmers designed by
the TRMJ team at CTP and the HTML5 UP template
Content by Sophie DeBenedetto
Welcome to Coditate a wellness site for programmers designed by
the TRMJ team at CTP and the HTML5 UP template
Content by Sophie DeBenedetto
You're staring down a nasty bug in your code, your program just won't do what you want it to do and you don't know why. The first step in dealing with an issue like this is to isolate the problem.
Don't be afraid to try different tweaks and changes to your code, just to provoke different behavior. This can help reveal the real underlying problem, or at least give us insight into what that problem might be. In order for experimenting to be helpful though, we need to have a clear understanding of what we expect to happen when we make specific changes to our code.
One way to simplify a complex problem is to clearly define our expected behavior.Ask youself: "Why is this a problem? Exactly what behavior am I seeing that I shouldn't be seeing? Exactly what behavior am I missing that I should be seeing?" We need to clearly define the parameters of the problem if we are going to solve that problem. Once we start experimenting with new code, we need to clearly define what we expect to happen with each change we make. Going back and forth between writing a line or two of code, and viewing the results of our changes, we can can gain a better understanding of the impact of our code.
There are some resources though that are available to everyone:
By articulating the problem, you gain an understanding of what your program does, vs. what you expect it to do, and why it doesn't do what you expect it to. Beyond that, by taking a step back and explaining the problem to someone else, you look at it from a new perspective and often gain a new understanding of the issue. There are lots of ways to engage in this practice.
When you're stuck, frustrated and confused, you have two options for dealing with those feelings. Ignore them, push ahead and exhaust your self . Or, take a break!