TIMOTHY TOLLEY EDA

Starfish Raglan

Problem Solving

Simple Problem

I have often been stuck on simple problems throughout the course so far. Mostly this has been due to syntax or not being able to remember the correct form to use to complete an action. The most recent event of this was trying to set up the counter on the 'game' within this sprint. I knew the concept required and mostly how to form it but couldnt figure out why my counter wasn't working. I used google to find a post on MDN about the basic 'for' loop which I was trying to create. This helped to refresh my syntax but it still was not working correctly. Next I checked the 'dev tools' on google chrome and realised that I needed to define the variable as the error message in the console said 'variable xxx not defined'. It was a bit of a frustrating process but I managed to find the solution which was satisfying. It was a learning curve to understand the dev tools in terms of finding my fault but now I have more of a grasp of the tools that are readily available.

It is not often that I find a problem which I have solved elegantly. Mostly it is a lot of trial and error. I think probably the above solution was amoung my most elegant solutions to a problem. Using the available resources and progressing through them until I had a viable and successful solution. Elegance when solving a problem seems to me to be mostly just trial and error. From solving any problem one learns the correct solution while also picking up new techiniques and forums etc which may help find a solution to a future issue.

Problem Solving Techniques

Pseudocode

Text-based method for preparing the code one wants to create. Writing in normal written English each step that one will need to complete to create the desired result. This is a form of problem solving which I usually use to prevent creating a problem in the first place - in other words, I use this 'solution' as a preventative method in most cases of writing code. Pretty confident using this method to solve a simple problem.

Try Something

Trial and error - the easiest way to solve a simple problem. First point of call when I solve a problem - comfy as.

Rubber Ducky Method

Similar to the pseudocode method, one 'talks to a rubber ducky' (ie goes through the problem in a very simplistic way) until they come across a simple mistake which may solve the problem. Taking a step back from the problem and simplifying it. Pretty comfortable - although I don't have a Rubber Ducky.

Reading error messages

I am happy reading an error message in most cases so far. Although I can imagine there will be times when an error message will look like giberish to me.

Console Logging

Console Logging throughout the javascript that you are writing shows you where your program is at at the time of the log. This can help to bring attention to where you may have slipped up in your code. I am less confident with this method as I often wonder whether a console.log will cause a problem within my code. I will try this more often.

Googling

Google is a mans best friend. Often a first point of call to find a solution whether it be a mozilla developers page or a forum.

Asking Peers

Super comfy doing this - havent needed to much so far as I have been able to find the solutions myself mostly.

Asking a Coach

Again super comfy!

Improving through reflection

Getting there - getting used to it.

Some fun-ctions

.map()

When the map function is called on an array it creates a new array made up of the results of a chosen function on each element of the parent array.

.filter()

Creates a new array of all the elements in the parent array which confrom to the conditions set out in the function within the filter parameters. Its like a the water in the sink after putting pasta through a colander.

.reduce()

This functions reduces the values of an array to a single value. It uses two parameters and then a function to return the single value. This can also be used to flatten an array of arrays into a single array.