Week 2: Cracking the Code with Arrays
06 Jul 2025![]() |
---|
Let’s code. |
This week I saw more and more of that screen above = spend more time in the coding environment. I also had time to go back to Week 1 to work on, and submit an optional challenge, “mario-more”. This gave me an even better understanding of ‘for’ loops. Prof. Malan mentioned something in this week’s lecture that grabbed my attention and spurred me on, on this journey, paraphrased:
“When you’re done with the course, you’ll have this bottom-up understanding of what’s going on. You’ll get techniques and a mindset for solving real world problems.”
Debugging The Way to a Solution
Most fascinating this week was the section of debugging - using CS50’s ‘Debug50’ . I like seeing ‘under-the-hood’. It turned out I had to use this tool extensively for one of the Challenges of the Problem Set. Watching variables change dynamically, albeit slowly, helps one quickly identify issues with the code. I notice with the course resource material (Main Lecture, Section and Shots), concepts are rehashed several times and from various angles, you will eventually ‘get it.’
The theme of Good Program Design kept popping up and code was edited ‘live’ and several approaches demonstrated.
I had some ecstatic moments of glory and self celebration, having coded a word capitaliser from scratch. Through a self imposed coding sprint, I tackled one of the challenges - Readability from start to finish without first looking at the hints and helps that come with the problem specs. Much time was spend with Debug50 as the program passed some and failed other correctness tests. When I eventually looked at the proposed approach, it was satisfying to notice my approach was not that much different.
![]() |
---|
Popping the hood - Debugging Code with CS50’s Debug50 |
Thinking Programatically, This Week’s Take-Aways
-
One of the challenges this week, Scrabble, pushed my limits of programmatic thinking. I couldn’t quickly crack the problem and find an approach. I had to go through the solution guide without a ready approach of my own. I learnt that it’s okay to not know and it is all part of developing programmatic thinking muscle. My understanding of arrays improved as I could understand the solution easily, but getting the idea/ approach is what I lacked.
-
Pseudo-coding really helps with the thought process and helps break down the problem into bite-sized parts. You quickly realise where functions can be employed and you’re able to abstract as much as possible. This isolation of ‘small solutions’ makes the problem look much smaller and surmountable.