Debugging: Your Secret Learning Tool

Debugging: Your Secret Learning Tool

I really like going though tutorials and walkthroughs when I’m learning new things. I think that the best way for me to learn something is by doing, but generally I get overwhelmed as to know where to start. So I generally start off getting my feet wet with tutorials.

Stackblitz has been very convenient to learn with.

Right now I’m going through Angular’s app tutorial (see what I’ve done so far on GitHub) and I’ve enjoyed it. It is nice to have a guide and not beat your head against something at the beginning. However, I don’t think that tutorials are the best way for really grasping concepts. What I do think is good for that is debugging error messages.

One of the errors I encountered during this walkthrough was that when I added the different phones to the shopping cart, the cart would update, not with the correct item, but just the first item in the array. I then had to go through and figure out why that wasn’t working. It turns out that I just wasn’t referencing the route parameter correctly. Curse you, case sensitivity!

While debugging this incorrect behavior, I learned that the + operator returns a numeric representation of the object in JavaScript. I would not have researched and learned that little tidbit of information if I hadn’t been debugging an error.

So if you’re ever frustrated debugging, slogging through error messages or unexpected code behavior, remember that you’re learning!

-Rachel