So… I had a mental roadblock for the 5 hours today on this algorithm for a project that I am working on. I was so close but yet felt so far away. As any coder would do, I kept on asking myself: “What did I do wrong? What am I not seeing? What am I missing?”. Even started doing this:
I started to panic, and the worst thing you could ever do is to start acting out of fear. Of course, my instinctive response was to start changing codes around with trial and error, just “hoping” the code would magically work. As expected, it just kept on creating more bugs, and became a disaster!
Therefore, a lesson for me and any one of you who do the same thing above: “NO, people! This is not how you should approach problem solving, you need to try another approach”.
Here are 5 things that I learned today and eventually got the solution to work:
- WRITE YOUR THOUGHT PROCESS ON A PIECE OF PAPER OR SAY IT OUT LOUD FROM SCRATCH
- Seriously, I started to grab some paper and started doodling on how each step should look like. I used examples on how the algorithm should work out and started to draw/write every single step down. It started to make sense for me when I saw it visually.
- PSEUDO CODE AND CONSOLE.LOG() ARE YOUR BFFS
- They are both equally important. Pseudo code allows you to write down the story login before you start coding or explain what your code does, and console.log can keep track of the steps/responses in your code when you run it.
- DROP YOUR EGO AND TAKE A STEP BACK
- Shoot, this is one was a main blocker for me. That’s because I tell myself that I’ve already spent so much time and thoughts into the first approach that I didn’t want to “waste” it. But because I was afraid to waste the code and restart again, I disallowed myself to see other possible approaches that could be so much better. So, chillax and take a step back, you can always save the previous solution in another file and you might need bits and pieces from there to work out your solution.
- DROP YOUR EGO AND ASK FOR HELP OR OPINIONS
- There are times where I refused to ask for other opinions on problem solving because I didn’t feel the need to “bother” others. This is not true, an extra brain gives you extra inspiration to be even closer to your solution. Don’t be afraid to ask for help. Remember how Pied Piper figured out their data storage algorithm from Silicon Valley? YES, the dick jerk algorithm. Shoot, you never know how others can contribute in coming up with a super awesome solution!
- DON’T FORGET TO TAKE BREAKS OR YOUR EYE OFF FROM THE COMPUTER
- This is important, or else you will drive yourself insane.
I am happy to say that I was able to solve my problem and the actual answer was 1000 times easier and shorter than I initially thought it would be! I just cleared my brain, took a step back, and coded with Ed Sheeran on. I can finally move on to my next task!!!!!!!!! I am so happy. I can finally sleep in peace. This is all have to say about my experience today. Until next time!
Kthxbai,
Lav