T E C H N I C A L B L O G

Sprint 4: Problem Solving

Getting Blocked on a Simple Problem

A problem that I recently got blocked on was that the bottom 3 images I had used in my Sprint 3 Technical Blog were not displaying when I opened the page from the remote repository. There were other images on the page which were fine, it was the images which I had created that showed up as broken. I opened the page from my local repository and the images were displaying there, which made me think that it wasn't to do with the file paths. I Googled what could be possible issues, such as having spaces within the filenames, and made the corresponding changes and pushed these to the remote repository but this did not solve the problem. It was quite frustrating having to test possible issues and not getting the right results, and as well there was the extra push process to the remote repo to see if the changes had made any difference. I also messaged my facilitator to see if he knew of possible solutions. I then kept researching and read that there can be privacy issues depending on the image settings and I thought this might be the issue since I had created the images myself. I thought that one way around this could be to upload the images to an image-sharing website and download them and replace the images in my local repo with these newly downloaded images. I then pushed these changes to my remote repo and tested the page and it worked fine. It took patience, research, and trial and error; but I was able to figure out this problem (which I had no idea would be one!). What I learnt was that simple problems can arise when you least expect them and that you have to be creative when thinking of a solution to them.

Solving a Problem in an Elegant Way

I was working on the concatMyArray exercise and at this point I hadn't realised that for each Kata there was a GitHub page giving context and pointers as to how to do them. I was struggling through them and feeling like there wasn't enough information in the tests for many of them and this made them very difficult to solve. This was making me really frustrated and feeling like I didn't know anything. For this specific exercise I Googled options such as "concatenation" and "converting a list of strings to a string", however, once I looked into these the solutions I realised that they did quite not fit the criteria I needed. When I Googled "concatenate array of strings javascript" I came across the Built-In method join(), which provided an elegant way of returning a new string consisting of the joined elements in an array. Javascript has a library of pre-written functions, such as join(), which are available to use to make coding simpler and more concise. From this I learned more about Built-In methods as well about how to Google better. I also learned that I need to read the information provided by Dev Academy in more detail, because if I had I would've seen the links provided containing information for each Kata and explaining which methods to use (and this would've made the exercise SO much easier).

Different Problem Solving Techniques

Pseudocode

Pseudocode involves creating a plan for your code and breaking it down into smaller, more manageable steps, that are written in plain English. This allows you to focus on coding a step at a time, rather than trying to make all the code work at once. I have been trying to get into the habit of doing this, however, I feel my pseudocode becomes a jumbled mess of semi-actual code instead... I feel I need better methodology as to how to break down a problem and rewrite the steps to solve it in pseudocode.

Trying Something

Often when I'm Googling how to do something, I will come across code that may or may not work for the problem I'm solving. The only way for me to find out if it will work is to then rewrite it to match my problem and experiment in the console.

Rubber Ducky Method

This method involves explaining your problem to someone/something (such as a rubber ducky). This is not a method that I have used as I'm more likely to draw a picture/diagram of what I'm trying to solve and I feel this serves a similar purpose. But I have heard this method is very effective so it's something that I will have to try in the future.

Reading Error Messages

I am trying to get better at doing this and understanding what the error messages are saying. This involves knowing both WHAT the error is as well as WHERE it is in the code. I also need to reframe my thinking about error messages and what they mean - rather than feeling like I'm not doing things right, "Errors in your code mean you're trying to do something cool" (which is a quote I got from this article). A positive way to think about error messages is that as the code you write increases in complexity, so will your rate of error messages and therefore, more experienced programmers encounter more errors than novice programmers do.

Console.logging

Console.logging is a means of checking our code. We test the code by inputting arguments where there are parameters and this then prints the answer in our console using the inputted arguments. If the actual answer is different from what we are expecting, we know there is an error with the code. This is a method I often use to check if I'm heading in the right direction with my code.

Asking Peers/Coaches for Help

This has been difficult for multiple reasons. I am currently overseas and so I'm unable to just pop into class and discuss what I'm having trouble with. This would be my preferred means of asking for help as I like to communicate with people face-to-face. I could try over the Slack Foundations forum but because I am doing the course over 15 weeks and I'm coming into the final few weeks, there aren't many people in the forum doing the same sprint as me. All the people who I initially started Foundations with are now doing Bootcamp and are no longer participating in the Foundations forum.

Using Reflection to Improve the Process

Often I will take a break and come back to the problem, with fresher eyes and a clearer mind. I might start the process again, drawing out a diagram or flow chart to visualise the problem and hopefully understand it in a different way. My reflection process occurs when I am thinking of how I can represent the coding problem in a visual way that helps me to understand it.