For an activity, we had to write a piece of code that would read a list of numbers and return the word ‘Fizz’ for any numbers that are a multiple of 3, return the word ‘Buzz’ for any numbers that are multiples of 5 and the word ‘Fizzbuzz’ for any that are BOTH multiples of 3 and multiples of 5.
When I first started, I wrote my code in that order. I couldn’t figure out why it wasn’t saying ‘Fizzbuzz’ for multiples of both 3 and 5 but ‘fizz’ and ‘buzz’ both worked… so I decided to use a problem solving method called the rubber ducky method where you explain out loud (or to a rubber ducky) what is happening in the code. I was really sure that what I had written should have worked. When I started explaining out loud, I realized the reason it didn’t work was because code reads from top to bottom so it was going through and assigning the words ‘fizz’ or ‘buzz’ first. When it does that, the code stops going through the rest of the code and moves on to the next number where it runs through it again. This meant that even if the number was both a multiple of 3 and 5, it never reached that part of the code where it makes the number ‘Fizzbuzz’. I swapped the order around and then it worked!
What I had learnt from this is that sometimes, you just need to say it out loud and read it from top to bottom as this is how the machine reads the code we write. A lot of times, small changes can make the code work!
An elegant problem is one where you write a shorter/more efficient code to solve something as opposites to a long code. I don’t think I’ve done this yet but I’m looking forward to doing so in the future as I get more confident with coding.
I enjoy using pseudocoding before I start writing because it helps me plan out what I am doing to do beforehand. I feel somewhat confident but still getting the hang of it. Sometimes I need to change my pseudocode as I write because I realise I missed a step or I had things in the wrong order.
I don’t think I am confident I this as I am still learning so there are a lot of things I don’t know well yet. I do try out things that I know but usually it doesn’t work and I need to look up on Google.
I am confident with doing this because prior to Dev Academy, I’d sometimes talk to myself out loud as I’m trying to figure things out… not sure if they’re quite the same thing but I do find that it’s really useful!
I am still developing my confidence in reading error messages. I do like how they tell you what’s wrong and I can go fix the exact part but sometimes the error messages don’t make sense to me.
I don’t feel confident with this. I haven’t used it much during Sprint 4. Prior to starting Dev Academy when I did some coding on Codecademy, they used console.log often (instead of return) and I thought that was how how you would get the output. However since I’ve learnt its not, I just haven’t thought to use it. I don’t think I fully understand how to use it to test code so I will be going over it during the break to get a better understanding of it.
Definitely one of my best friends to refer to while coding. There are so much resources and I enjoy using it. However it can also be confusing because sometimes the examples online don’t quite help me to problem solve the part I am stuck on. Confidence wise, I feel like I am quite confident about using Google.
I am not confident with asking my peers and that’s probably because I don’t want to keep posting on slack. There have been times when I did but I didn’t quite understand their explanation.
I am somewhat confident in asking my coach. I think I am not confident to ask sometimes and it’s the same thing as asking my peers, I don’t want to ask too much! I do find however, a lot of times I end up figuring it out myself before he replies and that works out too!
I don’t think I’ve really done much of this. I’ve just been trying to complete the tasks so this will be something I need to work on in the future.