Problem Solving

06 May 2022 / TECH
image of person wearing gray knit sweater
Photo by Mukuko Studio

This sprint when I was doing the gradebook challenge from JavaScript Kata, I couldn't get pass the first function which is to match each student with their test scores. I checked every letter in the function (it's not long at all), couldn't find the problem. Tried to run it again, still failed. Then I used console.log trying to figure out what's going on in there. The weird thing is Joseph's test scores were undefined, where everyone else's test scores were correctly shown. So eventually I moved up to check the gradebook object, where I defined each person as an object as the first step, and never looked back since. And it turned out I put "Joesph" instead of "Joseph" in thereā€¦ No wonder it wouldn't pass the test score to him. Because the name didn't match! I felt a bit silly, but also happy to have successfully found the bug. After this I told myself "don't forget to check your spelling, or syntax". Also pay attention to spelling when writing code. And console.log is a really useful tool.

How do I use the problem solving methods?

Honestly Console.log has become one of my best friend since I started learning coding. It is the most powerful tool when it comes to debugging ( in my mind). I use it every time when I want to figure out what's going on within my code.

My other best friend is Google. Google comes in when I want to do certain things but not exactly sure how. W3C and MDN give very specific explanations of each methods and syntax for html, CSS and JavaScript.

After googling how to turn my function from idea to reality, it usually requires me to use some new methods or syntax. Most of the time I did not understand what they are. I do find myself a bit hesitate to use them, but then I think, why not? What is it to lose? So I just bravely write it down in my code. Sometimes it would work, and sometimes it requires more problem solving.

I also google the error messages to find out what they mean and how to deal with them. Usually it leads me to Stack Overflow, where there are loads of smart people who have asked the question and given the answer already. I found it very helpful.

When both console.log and google couldn't solve my problem, I would ask peers and coaches for help. It still takes me courage and some pep talk to do so. But the response I got was usually very positive and helpful, and it has given me reassurance that helping each other is a great way to solve our problems.

Some new ways for problem solving I learned this sprint are pseudo coding, rubber duck method, and reflecting. I have tried pseudocode, but found out that my pseudocode was in completely different order from the code that actually worked.. I will give these methods some more practice to find out how effective they are to me.

Go Home >