Week 2: Cracking the Code with Arrays

Setting Up Codespace
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.

Debug50 Debugger
Popping the hood - Debugging Code with CS50’s Debug50

Thinking Programatically, This Week’s Take-Aways