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
- Psuedocode: 5/10 – I think my Psuedocode will get better over time. I think at the moment I struggle a little bit with it as I don’t really have a solid idea most of the time how to actually solve a challenge
- Trying Something: 9/10 – This is my first go to. Just trying something that seems logical at first thought and seeing what happens
- Rubby Ducky Method: 6/10 – Not one I have used so much yet I realise when I can explain something to someone then I know the problem should be easier to solve
- Reading Error Messages: 7/10 – Really helpful with syntax errors. Still get a little confused with some messages but I’m getting better
- Console.logging: 9/10 – Up there with ‘trying something’. I find it a great way to realise where I’m failing and what part of the code I need to work on
- Googling: 8/10 – Can be a little hit and miss sometimes but I find I can usually find something useful
- Asking Peers For Help: 7/10 – This is one of the last steps I would take. I’ve done it a couple of times now and have found to get useful answers. But in terms of confidence in asking, I am sometimes hesitant when I really shouldn't be
- Asking Coaches For Help: 5/10 – Would be the last option I guess. Slightly less confident as it means in a way I still l haven’t figured it out from all the above options haha. Also unsure how much work still needs to be done after I ask as I know I likely won't get the answer, but a hint/clue.
- Improving Your Process With Reflection: 7/10 – I’m confident in the sense that I try and note down different solutions I can then look back at later on.