Problem Solving.

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.


A simple problem solved.

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.



An Elegant Solution.

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:


A snip of code showing fizzbuzz

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.


A snip of code showing fizzbuzz

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.



Various Problem Solving Techniques.

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.


  1. Pseudo-code: This is something I need to spend more time working on. I definitely recognize the value of it but at the present moment I just find that I am not that good at it and need to work on getting my thoughts clearer and more concise when I write them down.

  2. Try something: This is a big one for me, usually also trying the most obvious thing first. I find it really amazing that so often it is the most obvious thing that is the solution and try to pursue this route first when tackling a problem.

  3. Rubber Ducky: I have dabbled with this but not too much. I think there is value to the method so will try to consciously put it into practice in the future.

  4. Reading Error Messages: This one is low down the list for me. At times I find the messages to be a bit ambiguous and they tend to confuse me. It may also just be a case of practice and familiarity here.

  5. Googling: A hugely beneficial problem solving tool! I would hazard to say that 99.9% of the issues I will come across in this career someone else has come across already and there is probably a solution out there on the internet. Also what I find is that the solution may not be specific to my problem, but close to it and I can then take their code and wrangle it to fit my problem and this in turn helps me understand the process better.

  6. Asking peers & coaches for help: I've lumped these two together as they are fairly similar. The most important thing I have found with this method is having an idea of where you are stumbling before you ask for help - that way you can ask pointed questions and get a resolution faster.

  7. Improving process with reflection: I have also found this to be hugely important to me. Through reflection I have been able to identify traits - both negative and positive - I have when approaching problems and this then allows me to be more aware of them next time and hopefully avoid the negative traits while enhancing the positive responses to ge the best results.


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.