Problem solving is something that will be at the core of pretty much everything we will do as web developers. With this in mind it is important to have a toolbox of problem solving techniques available to take with you into the fray.
So this week we had a number of coding tasks set out for us which were inevitably going to pose a number of challenges.
Early on we had a task of working with an object which was a persons called Terah and her object had a whole lot of details that related to her, such as her name, eye color, age etc. During the challenge we had to set Terah’s spouse as Adam and then in return set his spouse value as Terah.
The first part was simple enough but i found myself trip over when assigning Terah back to Adam as his spouse. I found I was trying to be to complex in my effort to find a solution so when I stopped took a breath and then tried the most simple/straight forward of solutuions it worked. My big take away was - when in doubt go with the most obvious as it usually is the most obvious for a reason.
Another problem we needed to solve was a classical fizzbuzz problem. With this scenario you are asked to print out a list of numbers from 1 -100 and you replace every multiple of 3 with the word fizz, multiples of 5 with the word buzz and multiples of 15 with fizzbuzz.
Getting the problem solved initially I used a for loop that worked over a previously set up if statement that had been set up to ensure the correct results would be printed. There is an example of the code here:
I was happy with my result but felt there could be a better way of solving this problem. After doing some research on the internet I found a video that laid out another way to solve the problem which would allow you to make changes to what numbers would be affected by the fizz buzz print out. It was a really cleaver way of approaching things and seemed pretty elegant to me.
The process also underlined to me the importance of using the internet as a tool to work through problems as there will be methods and solutions out there that you may not have thought of and it can be a valuable learning tool.
Here is a list of a variety of problem solving techniques that can be beneficial and how I feel my relationship with them all is at this stage.
So these have been my takes on problem solving. Granted they are in a very embryonic stage and I hope to grow these and flesh them out over time, however, for now I think they form a good basis to work from. Thanks for stopping by and I hope there was something useful here for you.