Welcome to Part 3 of The Harvard CS50x Adventures. This is a post apart of the Harvard CS50x Adventures, where I take the CS50’s Introduction To Computer Science course on edX. In this post, I show you the things I learn, the challenges I face, and how I learn programming as a beginner.

In Part 2 of The Harvard CS50x Adventures, I dove into the C programming language learning some its basics. I solved a few problems focused on challenging my fundamental knowledge of loops, conditions, and variables. The problems consumed quite a bit of time, but eventually, I was able to solve them.

This week was a breeze, though. The problems were relatively easy to get through, and I’ve built a lot of programming momentum. Let’s jump into what happened.

The CS50 IDE And Some Clarification

cs50 ide

Off of Week 2, Professor Malan gave a brief overview of some tools and actions we could take when we run into bugs and problems while coding.

The first tool, which is unique to CS50, is a help50 function where if you use it like this:

help50 yourfile

It can help you find the issue with your code and what fix you should implement to compile your code.

While he was at it, the professor also explained functions like submit50, style50, and check50, which were used to submit your project, check how good your code looks, and check if your system fills all the requirements, respectively.

It was kind of weird that he explained them in Week 2 instead of Week 1. After all, we already had to use some of those tools to submit the assignments in Week 1.

Nevertheless, the new thing for this week was the CS50 IDE and its debugger. David Malan showed us how to debug our code using the debugger in the CS50 IDE, which was pretty cool. I figured out the coding without using the debugger, but it’s always a nice feature to have if I do run into a problem.

Arrays, I Love Them

The main lesson this week, however, was arrays. For me, arrays were something I could get my head easily around. Programming with arrays is easily visualized.

When I have arrays, I visualize it the same way that CS50 presented it. When you set an array of some number, I imagine that same number of boxes in my head from left to right.

Each box is associated with a number and whatever I’m putting into the specific section of the array. When I’m able to visualize it in my head, it makes understanding and the recalling of variables much more straightforward.

Understanding memory and RAM was a bonus as well. It’s quite interesting to think about how the hardware I was so obsessed with works with the software.

A few years back, I was building a new computer and looking for PC parts. I went crazy researching PC parts and learned a lot about things like CPUs, RAM, and everything associated with their speed and working efficiency. Now I’m also learning how programs work with these PC components, which is fantastic.

When I code, occasionally, I like to think about the software-hardware connection and if I’m coding something efficient and less strenuous on the computer. I’m sure there’s a whole lot of information on efficient coding out there that I have to absorb one day.

But anyway, back to arrays.

What A String Really Is, Plus Libraries

The other thing we learned this week is that a string does not fundamentally exist in the C programming language. A string is actually an array of characters. Through the CS50 library, we can make the getting and usage of strings more accessible.

Additionally, we were introduced to the whole concept of libraries and how we can search the manual pages for functions within libraries that will make our lives easier. A library is basically a collection of functions that you can borrow and use in your code when you include some code in your header.

For example:

#include <stdio.h>

This gives me functions like printf, which allows me to print anything I want on the screen.

We don’t need to reinvent the wheel with libraries. A lot of common functions we want to use has already been created by someone else, and we can often use that code to save a lot of time and be more efficient. Thus, instead of spending all our time recoding a primary function, we can spend more time building complex applications.

As I was coding, I noticed some things that could have been done more efficiently, as well.

For example, I had to make sure the user was inputting the right input across multiple problem sets. I often manually coded in code checking for positive integers, 2 arguments, the right characters, etc.

I totally could have turned them into my private functions and made the coding much more efficient. And maybe in the future, I might build my own library to help others out as well.

A Smooth Run Of The Problem Set

Like I said above, I understood arrays quite quickly, which made the problem sets for this week a breeze.

Unlike last week where I spent over 6 hours trying to program something, this week went by pretty fast. I only took a few hours to solve all three problems. It was much easier to know precisely what kind of code I need to implement when working with arrays.

First, it was a readability problem where I take in a string and then analyze it to figure out what reading grade level the text is for. Then there were two problems related to cryptography where I encrypt plaintext with a key and output ciphertext.

I think part of the reason coding didn’t take that long this week is also because I’m getting better. Having already worked with C for one week, coding has definitely become much easier and more efficient.

Building Momentum And Learning More

I finished this week with so much energy left that I accidentally started Week 3 before writing this post. But now that this post has been written, it’s time for me to jump back into learning and continue on with algorithms.

I hope you enjoyed Part 3 of the Harvard CS50x Adventures. Get ready for Part 4 of the CS50x Adventures where I dive into Week 3 of the CS50 course.

And if you haven’t read Part 2 of the CS50x Adventures, go catch up. If you have any questions or comments, don’t hesitate to leave them down below as well. Have a great day!