About a time when you were blocked on a simple problem
This week, I experienced being blocked quite a few times. One moment you think you got it and the next, you're not sure if you've understood anything at all. The repetition of understanding and then not understanding was hard because it was hard to grasp where you were in your learning journey.
One module that was especially difficult was the Build-in methods section. This is where you are expected to use certain methods in JavaScript to solve a problem. The second question asked you to take a sentence and capitalise the first letter of each words and return this as a sentence again with the updated result.
First, I was lost since it felt like there were so many things you needed to do. However, by breaking down the problem into smaller blocks, I was able to get better understanding on what the end result should look like and what the tasks were to get there. This allowed me to enter better keywords to search for more specific information. From there, I wrote down a pseudocode within the repli-it. Then, I tried writing out the code under each pseudocode.
About a time when you elegantly solved a problem
I am not sure if it's an elegant way to solve this however, I've been realising the power of function throughout the Kata training we've done this week.
For example, there was a problem where you have to calculate the average score of a student. Each student had a series of scores which was used to calculate the average value for.
In the previous question, we've already defined a function that calculated an average. So the solution was simple - use that average function created before on the series of scores for a student as below:
//average calculating function
function average(array) {
let total = 0;
array.forEach(num => total += num)
return total / array.length;
}
//getting average for student
function getAverage(name) {
let oneScore = gradebook[name].testScores;
return average(oneScore);
}
The above function allows you to enter a student name, and then it pulls out the series of scores. Then, you apply the average function onto that series of scores. I was a little surprised how simple the getAvrerage function turned out to be but I've realised that this is the benefit of using a function. I learnt how versatile and powerful function can be and gives you space and capacity to write more complex things but execute it in a better flow.
Reflect on how confident you feel using each of these problem-solving techniques/processes:
--- Pseudocode ---
This is the first thing I do before writing out anything and have used it throughout my Kata training this week. I also write out the expected result with the pseudocode when I'm really stuck so I get a better understanding on what I am needing to do. I am pretty confident in using this process as it's been my go-to workflow which has helped me a lot with my learning.
--- Trying something ---
After writing out pseudocode, I try writing out what I can with my current limited knowledge. At times, I really had no idea what I should be doing so had to google first before actually trying something but this process has been pretty consistent with my problem-solving as well.
--- Rubber ducky method ---
I've started using this method relatively late, I feel like I could've started sooner. Just repeating out the problem out loud has given me better understanding on where I am at. I think I can use this methods more proactively as I know it does help me re-organise and de-clutter my mind. It gives you clarity on where your understanding is which is important when trying to figure out the next step.
--- Reading error messages ---
This was repeatedly practiced throughout the module in Repl.it as the test function give you an error messages as well as the system error. Reading this and searching what it meant gave me a better understanding of where I was missing certain knowledge or was a gap with what I knew and helped me get information on those missing things. It also helps me troubleshoot however, I think I can practice more with picking out the important/relevant part of the error messages.
--- Console.logging ---
I am the least confident with this method as I kept forgetting to use this despite it being the most useful. I started using this more at a late stage of the Kata modules and found how useful they were with just understanding what the code was doing. It helps you keep track of where you are at and guides you to the next step (since you can see your current progress). I would like to be more confident in using this as I understand how much it can help with troubleshooting if there's something going wrong and also gives you confident in our progress.
--- Googling ---
I think the usage of confidence for this process is linked with other problem solving skills like reading error messages or console logging. You can search anything in Google but the problem is that you're not sure which result applies to your situation (which can be significantly different or similar). Sometimes, it can be something you've never heard of and not sure how to integrate it in your own code. Searching the wrong section of the error message may give you completely different next step. So as handy and easy Googling can be, you'll need to understand what you don't know or what you want to do. The more specific you can be with what you want, the better result and answers you'll be able to find.
--- Asking your peers and coaches for help ---
This has been quite difficult for me as I am not good at asking question or help in general and is something that I need to work on to be confident in. Reading other people's question in Discord has helped me with how I can frame question in a way that's easy for others to answer. Also, it's a mindset shift with asking for help where setting a time limit and if not solved within that, reach out for help. When stuck, it can be hard to get out of that zone so setting a limit may help me with reaching out within a good timeframe.
--- Improving your process with reflection ---
Reflection has been a core part of the learning journey with weekly reflection and smaller reflections after each task. I think I can be more confident with reflection in relation to problem-solving. I think it's important to record or reflect on the points you've struggles and how the solution was retrieved rather than just leaving the problem as soon as it's solved. This way, we can maintain knowledge acquired int that problem solving process better.