Problem Solving in Programming

Click here to return to my homepage

What I have learned so far...

24th September 2021

A picture of a colourful ligthbulb

What is programming?

Lets start with the fundamentals here - computer programming is the art of writing instructions to be executed by a machine. These instructions must follow a predetermined, formalised, set of rules. These rules determine what we can write and how we can utilise what we write. In a nutshell, a programming language such as JavaScript is a combination of logic and syntax. If we want to get meta with it, it is a set of instructions for writing instructions.

What is problem solving?

Problem solving is the act of defining a problem; determining the cause of the problem; identifying, prioritising, and selecting alternatives for a solution; and implementing a solution. Key to problem solving is the ability to break complicated processes down into simple steps.

Problem solving in programming

Turns out, programming is mostly just problem-solving. To become a programmer is to become a lifelong learner. To a lifelong learner, problem solving is one of the most important skills you can develop. It is also a skill that takes constant practice. Luckily there are many different methods available to us as programmers (aspiring and otherwise), to suit the whole range of learning styles.

Some of the main examples are:

A quote about problem solivng by Seymour Papert

Problem solving and my JavaScript journey

JavaScript and I met just under two weeks ago, and I have to say, we've had a pretty rocky relationship thus far. I'm going to hang in there though, as I'm confident that behind that overwhelming and abstract exterior there lives a beautifully logical and elegant powerhouse of potential.

Pseudocode (which became pseudocode novellas if I'm being honest), rubber duckys and Google were my life lines as I treaded the murky waters of JS this week.

Solving a problem with (relative) elegance and grace

My personal problem solving highlight came last week when working through the coloured dot game in the DOM interactions section. Our end goal was to have a game board with dots that turned blue, green, or dissapeared depending on whether you left clicked, right clicked or double clicked the mouse. In addition, each click colour assignment had to correlate with a counter. Easy peasy right?! 😬

With the help of my very patient partner, I deconstructed the problem into its individual parts and slowly worked through each bit, making sure I fully understood the what and the why of what I was doing by explaining it back to him in layman's terms.

A crucial part of this learning was being able to then immediately help out a couple of my coursemates with the same problem. Explaining the process again really strenghtened the logic in my mind so it was a win win for everyone!

Getting stuck - what I've learned

The kata challenges this week provided ample opportunity to practice the art of being completely lost. A big learning this week was that I'm not always good at noticing when I'm tired and need to walk away. There have been plenty of times this week where a problem will seem impossible at the end of the day, but with a good night sleep I've been able to better deconstruct a problem and find the logic.

Conclusion

Thus concludes my very non-technical tech blog. My brain is fried and I'm dreaming in JS so I hope you've enjoyed my light reflections at the end of a very long week ❤

Useful resources

How to write good pseudocode

JavaScript is problem solving