How Coding Changed the Way I Look at Problems

Some common patterns in the ways that I solve problems on the screen and in real life

Connor Sparks
Better Programming

--

Photo by Olav Ahrens Røtne on Unsplash

I‘ve been writing code for a decent period of time, around seven years, and even though I’m not the best at it, it’s changed the way I look at problems in life. As I’ve become better at coding, and solving the problems that come with it, I have begun to see some common patterns in the ways that I solve problems on the screen and in real life.

The Problem Is the Problem

This is by far the biggest thing that I learned while attempting to write my first code, and it’s something I don’t see talked about a lot. When I first started out trying to solve some basic data structures and algorithm problems I struggled, finding it almost impossible to think of a solution to what was in front of me. I looked at the problems for hours, unable to create a solution, with no idea why.

The issue was that I was looking at the problem incorrectly. When faced with a problem it is important to sometimes stop and try to reframe the issue. By looking at something from different perspectives the answer can quickly become clear. It’s about distilling an issue down into its rawest form, understanding exactly what needs to be fixed.

I ran into this problem once while working on a VR application in Unity. I had to create a boundary system that stopped the user from exiting the play area that they designated. This part wasn’t too hard; the issue was figuring out how to move it along with the player when they teleported throughout the space. This left me with the problem “How do I get the walls around the player to stay in the correct location when the player changes position?” Trying to answer this question proved difficult, as the longer I worked on it, the more problems I found. I needed to make sure that it was the same in world space, and I needed to make sure the user stayed in the same space.

However, after thinking about it throughout the day I was able to reframe the problem using other issues that I’d come up with earlier. Instead of trying to solve, “How do I get the walls around the player to stay in the correct location when the player changes position,” I tried to answer, “How do I keep the walls stationary relative to the player.” While this isn’t that different, by just changing what I was trying to do, it became easier to come up with a solution.

Slow Down

When I first started to code, I began with a $100 computer, a bad IDE, and lots of free time. At this point in my life, I had no idea what it meant to write code or even that this was something that people do for fun and as a job. All I had was some tools and curiosity.

For weeks over the summer, I sat at this computer changing the very basic Python code in order to see what happened. I had no idea what I was doing, and it took days over the summer before I understood how to write a simple print(“Hello World”) statement.

While this would have been discouraging if I’d known then what I know now, it was really gratifying to create something from what seemed like nothing. Even if I had no idea what I was doing, taking it slow, and making an effort to understand the ins and outs of the code made it all worth it.

This is still something that I do today. Whenever I encounter a problem, I take a deep breath and slow down. Even if I have no idea how I’m going to do it, I relax and just take some time. Accepting the fact that I don’t know what to do makes it easy to have the humility to work through a problem the way I need to.

Think It Through

For a while, I was a person who thought it was an achievement to keep everything in my head: never writing anything down, simply remembering everything I had to do, and then doing it whenever I felt like it. I soon learned that this was not a smart approach, as things began to fall through the cracks.

Recently, I realized that this is the same in coding. While I could just sit down and try to solve the problem, it’s more important that I take steps to really think through what I am trying to solve. For me, this means getting out a sheet of paper and writing out all my ideas until something clicks. Doing this frees up all the brainpower needed to keep everything straight, and allows me to see the problem for what it is.

Thinking something through can takes all sorts of forms. It can be writing it down, like me, talking to a rubber duck, or calling up a friend to talk through the issue with them.

While none of these things is that groundbreaking, they’re some of the tricks I’ve learned when it comes to solving problems. I hope to use them not just when coding, but all throughout my life.

--

--

👋 My musings here are basically a public stream-of-consciousness journal, so please forgive my writing: it’s getting better, I promise.