Problem Solving Blog Post
Tell your non-tech friend a story about a time you:
were blocked on a simple problem.
Last night I was working on a problem which involved adding scores to a students information. I wasnt able to achieve the outcome in what I felt was a reasonable amount of time.
I had used a combination of a tool we can use to see whats
going on console.log() and google to reference
the tools I was using as well as look at some other peoples
examples.
After a bit of frustration and struggling I managed to pin down that the breakdown was happening at the point where I was trying to point to the student that I wanted to add the information to. Turns out I was pointing incorrectly!
What I had written down was:
gradebook.student.testScores = scoreToAdd
and what I needed was:
gradebook[student].testScores = scoreToAdd
It took a long time for me to get there and I think I could have avoided a lot of frustration if I just took a break to refresh myself instead of having the mindset "I'll take a break as soon as I finish this."
elegantly solved a problem.
So... Also off the back of a silly mistake. I accidentally misread the fizzbuzz challenge.
Fizzbuzz is a challenge where numbers that are divisible by 3 needs to be replaced with the word fizz, numbers that are divisible by 5 needs to be replaced with the word buzz and numbers that are divisible by 15 need to be replaced by fizzbuzz.
I had initially thought that the first part of the challenge
needed to take a list of numbers not individual
numbers. So although I managed to solve the problem fairly
quickly I was not passing the test we use. Luckily I was
fairly confident in the code I wrote and ended up chucking
the code into the browser console so I could log the results
to see why the test wasnt passing. (note: This was before I
worked out you could console.log() and run the
xyz.js file in the terminal with node.)
When I saw the results where as expected I started to talk to myself or 'rubberduck' and eventually, and I'm not sure when or how, it dawned on me that I was only supposed to check individual numbers and not a list of numbers. From there I was easily able to change or 'refactor' my code to pass both that test as well as the next test which was to check lists, and that felt good.
I think it goes without saying I would have saved myself a lot of time had I just read the questions properly. 🤦♂️
Reflect on how confident you feel using each of these problem-solving techniques/processes:
Pseudocode: I cant say that I use pseudocode that much out side of challenges yet, I still struggle a bit to break down my problems enough to justify using it. I do use a notebook to list bigger things though, for example when working on my blog I made a list of things that needed to be done and checked them off as I completed them.
Trying something: Probably my most used problem solving technique.
Rubber ducky method: I do use this method
from time to time but I only do it in its truest form when I
am stuck stuck. Otherwise I
generally will talk the flow of logic out to myself and see
if I can see something going wrong or use it in tandum with
console.log().
Reading error messages: I think I am alright with this though there definitely are some that will throw me for a loop.
Console.logging: Through this most recent challenge I definitly feel this one beginning to stick. Before I would always forget or try brute force and guess what was going wrong or I would not know where to log to get any useful information. I am super happy that I am starting to feel like I'm getting more value from this.
Googling: Probably the second most used. I
dont offhand know syntax and I need to reference docs or
code examples a lot to make sure Im writing things
correctly. I also need google to reference the specific
tools I want to use to brush up on them eg.
.map() and .filter().
Asking peers/coaches for help: Up untill now I have managed to get by mostly on my own, I do have a friend in the industry that I will sometimes send my code to and ask how he would solve the problem to see what tools/approach he would use. Sometimes we have a discussion about the solution and then when I run into similar things I will reference the tools he has brought my attention to as mentioned in googling and try to use them.
Improving your process with reflection: I definitely do reflect on my code however I dont do this conciously.
Reflect on a time you were reluctant to ask for help. Consider what made you reluctant to do so. What might you try differently next time?
At the moment I believe I am reluctant to ask for help as I am working ahead of schedule so I dont need to worry so much about missing deadlines.
When I get blocked and things take a long time to solve I have a decent amount of runway to attempt the problem on my own. I believe also honing some of my problem solving skills in the process.
In the future where deadlines are creeping up and I am unable to solve the problem myself in a reasonable amount of time I will definitely reach out for help but for now where I have the time I dont feel it is as necessary.