Andrew's Blog

Problem Solving

Upload Date: 25th September 2020

When I got stuck

After reading through materials and researching for this Kata, I was ready to take anything on. For the first 3 Katas, it was mostly smooth sailing. I was able to work through the problems without a break for a couple of hours, not feeling remotely exhausted. I was in what you would call “the zone” 🧘 . The JS Gradebook Kata didn't seem to be too much of a problem for me either, I was going through it like cutting butter with a hot katana - until the final stretch exercise.

I had spent a millenia and a half trying to solve that stretch. It was a simple function where it just needed a basic for loop function and a knowledge to create/update objects and elements were needed. However, I was double whammied by the fact that:

  1. I completely missed/forgot that there was already an array called “students” at the top of the console. The question required me to use the “students” argument but the whole time I was trying to find out where the “students” argument was referencing.
  2. Because of that, I misunderstood what the function was supposed to do, thinking it was asking for a function where I could register new students and new scores instead of bringing up students' records from existing arrays…

Only when I accidently closed the tab and reloaded the console, I re-found the top of the console where it listed an existing array of students. 🤦.

This made me realise how important it was to take a break, even if you were “in the zone” to make sure you can clear your mind and look at the whole problem from a new angle.

When I breezed through

It’s a lovely feeling when you easily solve a problem that you struggled through before. The Super Fizz Buzz Kata where I had to use a mix of for-loop and conditionals to solve reminded me of a very familiar exercise I completed in the Free Code Camp, with only a few variations.

Before I jumped in, I wrote a few lines of pseudo codes and recalled the experience I had from the previous exercise. Of course, I had to get stuck because I used the “=” operator instead of the “==” for the conditionals, but other than that small hiccup I was able to get through it in no time.

Problem solving methods I used

Googling

It can be a little bit of a double edged sword. When you know how to specify the problem without getting TOO specific, it will really help. But if the search scope is too broad or too specific, you may find yourself being lost in a sea of information. Also, you can often find yourself digging down the rabbit hole if the answers of your questions end up with even more questions… for example, when I was researching ".map", I was also trying to figure out what "thisArg" meant...and then trying to find out what “apply”, “bind” and “call” is… and then… so on and so long.

Youtubing

When google results are not what you are looking for or you are just tired of reading, a quick 4 minute instructional video can help you understand a concept much clearer than most technical blogs.

Pseudo Codes

Breaking down the problem into a more understandable bite size pieces can be very helpful, and also helps you from getting lost in the problem. Commenting each parts of the function can also make it easier to read.

Console.logging

I use this all the time. I often make mistakes with () and []s, commas, semicolons and what not, it is a must for me to make sure that I check often that I didn’t miss any notations.

Asking for help

I can be stubborn sometimes, especially when I want to prove to myself that I can do a certain task. Also by doing it myself, it proves to me I understood the subject properly. But of course, I know it will only get me so far in life. I will start asking for help when I do get stuck.

Home

Go to top