PROBLEM SOLVING

Problem solving stories and techniques..

Was blocked on a simple problem..

When I first thought of getting into coding my girlfriend was kind enough to buy me a beginners guide to coding book where you could follow along with their examples to produce something like a website, or a simple programme. So I thought, easy enough, even if I don’t understand everything I can still type in the exact code they have and I’ll get the same thing… not quite.

While I can’t remember a specific time, there will multiple times where I had copied a big chunk of code, or had followed a few steps in a row, without stopping and making sure I had written it correctly. One thing with code is that if you put one bracket, one full stop, or one other thing in the wrong place or you forget to put it there, then it can mean the whole thing doesn’t work.

As I didn’t know many problem solving techniques my go to solution was to line by line go over the code and compare everything to what I had written on my computer. Sometimes I would lose hours to just realise that I had forgot to add a closing bracket or I had misspelt something.

The pain was immense and it was for sure demotivating as it felt like I had wasted hours where I could have instead been learning something productive. But looking back, it wasn’t actually wasted time as I learnt a lot from it. Don’t rush too far ahead without checking code! It’s much easier to try and fix a few lines that don’t seem to be working rather than a whole page!

Elegantly solved a problem..

I feel like there are times I’ve come close to elegantly solving a solution, but haven’t quite been as elegant as I thought.

For example, there’s a challenge called ‘Fizzbuzz’ where if you are given a number and it’s divisible by three it will say ‘Fizz’, if it’s divisible by five It will say ‘buzz, and if it’s divisible by both three and five it will say ‘Fizzbuzz’. When I saw this I thought, wait, I feel like I’ve done something similar before – hold my beer!

So I wrote the code out in one go, just as I had imagined. I had used the write kind of code to get the solution as well. I felt great, I was solving something in record time, it looked solid, well done me. However, lo & behold, when I went to test it didn’t pass all the tests. What? How can this be? It looks just like it’s supposed to!

While I had gotten the code right, I had put it in the wrong order. So while it was a simple fix, it showed me that even if a code looks ‘elegant’ it still needs to be tested. Then to add a pinch of salt to my minor wound, when looking at the solution code, I found it could have been made a smidgen shorter. So whilst its’ great to have moments of positivity and elation in realising you’ve figured something out due to having been practicing, at this stage in my learning there is still always something to take away from a successful solution, no matter how elegant I think it may have been.

Rating my confidence with these different problem solving techniques