Blog Home

Problem Solving.

Meme of shifty Fry

Code I got stuck on

There are a lot of times when I get blocked by a simple problem and the solution is usually forgetting a simple bracket, or forgetting a bit of syntax. An example of a problem is when during the Javascript Olympics challenge that was given to me, I mistyped a word and was not passing the test. I wracked my brain for 30 minutes and then it hit me, I had mistyped a word. The thing that worked for me was to use the rubber ducky method, which is to talk through the code to figure out issues like this one I had. Through doing this I learned that there will be times when the code will not work, and the best way to fix the issue is to stop, walk through the code and the problem will seem trivial.


Code I was proud of

During the JavaScript Olympics challenge there was a problem that required a loop through to and remove the odd numbers in an array. I thought about it and decided I could do it with a one liner. I realised that I could use the filter built-in method and filter out the odd numbers putting through a statement using the modulus operator and it worked!


Recipe graphic
Source: https://www.conceptdraw.com/How-To-Guide/easy-recipes

Pseudocode

Pseudocode is putting code in plain words. You can think of it like writing and planning the recipes before cooking. I used pseudocode a bunch of times during the coding challenges and it really helped me to write cleaner code and to write my code efficiently.


Trying Something

Trying something is exactly what is sounds like, to try something. I personally was not stumped enough to just bash away at the code and try something. I think that writing pseudocode and using other methods really helped me in avoiding this method.


Recipe graphic
Source: Florentijn Hoffman

Rubber Ducky Method

The rubber ducky method sounds strange but is actually a really nice method to use. I personally used it a lot and as I said before it was a method that I used quite a lot and it helped me solve some problems. The rubber ducky method got its name because programmers would talk through their code to a rubber ducky to figure out why their code might not be working.


Reading Error Messages

Reading an error message is very useful and come in handy a few times for me. Sometimes error messages can be confusing and searching them up is useful in understanding what they mean. It can be particularly useful when an error message is straight forward like telling you you missed an easy syntax.


Console.log gif
Source: https://elisweb.co.uk/blog/style-your-js-console-logs/

Console.log()

This is one I use all the time. Console.logging is when you have a function that is not working and you just put a bunch of console.logs, or you can think of them like the code printing something out, and you can understand why it might not be working through the code printing at every step.


Recipe graphic
Source: https://www.google.com

Googling

Like I mention when reading error messages, sometimes you might need to search or Google the error message. It is very handy in this regard and also when you can’t think of a certain syntax you can Google it and it will come up and also give you examples of how to use it.


Ask Amanda Image
Source: Amanda Augustine

Asking for help

I personally did not use this as I wasn’t stuck on a problem so much that I felt I needed to reach out. I know that I will definitely need to ask for help from my peers during my studies. I also did not use this method the same reason why I did not ask my peers for help. I feel like later on in my studies I will definitely be asking my coaches for help.


A journal
Source: Matt Ragland Copyrighted free use

Reflection

I reflect every time I finish a challenge. I feel it is therapeutic and also allows me to maintain the skills and knowledge I gained through doing the challenges. It is useful and I feel like it is a skill and habit that I need to keep doing to be successful in life and specifically in my studies.


Finally

There are a lot of useful methods in problem solving. While I did use most of them, I think I have just scratched the surface in terms of problem solving methods. During my studies I know I will use much more and I look forward to putting them in practice.