How to Learn Coding (and From CS50x).

What’s the best way to learn coding? How do I go about it so that I can make the most of the courses I take? This article has a detailed explanation that will answer these questions and more!

When learning to code, if you're just getting started, you'll likely have a few misconceptions. I hope that the points in these articles help clear up these misconceptions and prevent you from making the same mistakes I did.

I. How to approach learning to code (and learning from the course CS50x):

1. Don’t rush:

This might be the most simple yet crucial advice I could give to learners.

When I was learning C, like most students, I was competitive. I wanted to be the first one among my peers and fellow students to “complete” C. I tried to speedrun the lectures and complete the problem sets as soon as I could.

At the end of the 3rd week of the lectures (in CS50x), I grew frustrated with my inability to smoothly clear the problem sets within an hour (an unrealistic goal). I had to take a break from it to clear my mind and not be hounded by the goal of “completing” C as soon as I could.

It was later, when I got back to it and did Problem Set 4 (in CS50x) patiently, that I realized that I was going about it the wrong way.

You don't "complete" C or any other programming language like you would a topic in a school subject. The knowledge that you gain from learning C will help you for a pretty long time, and you have to approach it with this in mind.

Furthermore, don’t dive into any coding exercise or problem set, likening it to a problem. The speed at which you complete a problem set also does not indicate a greater understanding of the topic.

The problem sets in CS50x aren’t problems. Each problem set teaches you something, from logic building to understanding bitmap representations of images (and how to manipulate them).

The problem sets are supposed to be programs or projects given to learners for them to learn from—a lecture in themselves. Try to learn something new from each coding exercise that you do. You’ll be surprised at how much these seemingly small problem sets can teach you.

Coding isn’t something you learn faster by training harder and faster. It requires consistent practice, patience, and focus. You can’t expect to devise solution codes for problem sets super fast just because you understand a concept pretty well.

So, learn and code patiently. Go through the content you’ve been given in CS50x (or any other material you’re referring to) multiple times if necessary for you to understand something.

When doing any coding exercise, never look for solutions just because you couldn’t think of an answer or your program failed a few times. Try the program a few times. If you still don’t get it after a few attempts (and it starts to get frustrating), I suggest that you take a break from that problem. Go to the next topic or exercise.

Later, return to the same problem again. If you still aren’t able to come up with an answer, then you can look for a solution. However, you should read and understand the solution code, and once you’ve understood it, go back and try to code the program on your own, without looking at the solution.

You might complete topics quicker if you rush. However, you will always have straggling doubts and might not have full confidence in the topics you’ve learned. To me, this seems disastrous, and I don’t recommend anyone learn from CS50x or any other course in such a manner.

2. Ad infinitum:

A number of problem sets call for some background reading in order to help you better understand them. You should do a lot of research for these.

The complex tasks computers could carry out seem difficult for us to imagine. How could a human create a computer—a machine with such enormous processing power? The efforts and knowledge put in to build these things seem incredibly intricate and complicated. We don’t dare think that we could ever be capable of understanding it within the short time we have.

However, all these complex functions computers are able to carry out these days are the results of logic developed and applied by humans. This logic and the knowledge behind it are within our reach, and we are capable of learning and eventually understanding this knowledge. When you achieve this mental shift, a desire to learn and comprehend more develops.

This step will go some way toward explaining how I managed to get this shift and how I came to view coding the way I did.

Knowledge begins to feel within reach as you conduct more independent research and education. We realize that we are, in fact, capable of learning and eventually understanding things that we could previously never fathom. This is because you gain a wider perspective on coding, how it has been developed (with its own errors during its creation as it was made by humans), and the real-world impacts each concept you learn can have.

Search up "Y2K problem" on your browser, read up on it, and perhaps it will be the first step to your start at independent research. Once you’ve read it, what do you think? Computers are ultimately developed by humans like us—those capable of making mistakes (as illustrated by the Y2K problem), those who learn and grow. Do you now feel a stronger connection to the code you are learning? Do you have a feel for the potential immediate impact it could have on both your life and others’ lives?

A succinct illustration of the Y2K Disaster’s effects. Image Source: whysurfswim.com

I learned this lesson when I was doing problem set 4. It allows you to code a program capable of differentiating objects in an image. I had always believed that a challenging task like that was undoubtedly beyond my capacity before I started this program. I had assumed that it required some sophisticated artificial intelligence "stuff" that would likely fry my brain if I even tried to understand it. However, I did the program, understood the logic behind it, and felt so much closer to coding then.

When learning — the sky’s the limit! Image Source: https://lovepik.com/images/png-book-hills.html

Once you are aware of how much more you are capable of learning and comprehending, you will feel a zeal to study and acquire new knowledge.

3. Do tedious, and grow your toolbox:

Once you’re done with a problem set, always try to look for more efficient solutions to it on the internet. While this may seem tedious, it will teach you new perspectives and logic for the same program. This grows the “toolbox” you have when coding programs.

As your “toolbox” enlarges, you’ll be able to visualize multiple pathways to your result or solution code. Similar to math, you can solve problems more quickly and effectively if you practice more.

Knowing multiple solutions can be useful when dealing with particularly challenging problems that can only be resolved using a particular approach.

Therefore, “do tedious,” and you’ll definitely come to appreciate it later!

4. Take notes:

Although taking notes while listening to lectures is completely optional and a matter of personal preference, it will make your learning seem more productive and like it is progressing. It will make you watch the lecture with greater focus.

You can make compact notes. Make a list of any questions you have or information you have found particularly novel and interesting. Then, do some research and try to clear up the questions or doubts you’ve jotted down.

When I'm learning, taking notes makes me feel more productive, and I enjoy doing it.

Solve all the problem sets diligently, giving each a significant amount of time

II. Steps to follow when learning from CS50x:

  1. Learn from each lecture patiently, don’t rush. Optionally, take notes when listening to lectures.
  2. Never skip the video shorts before taking a look at their topics. Skim through the shorts, and if you think they're worth your time, watch them. The shorts frequently contain more in-depth explanations. Sometimes, the shorts also cover topics that aren't covered in the main lecture.
  3. Solve all the problem sets diligently, giving each a significant amount of time — and try to solve them on your own. If you don’t get it, go through the hints they’ve given. If this isn’t enough, watch the walkthrough (this makes understanding the problem much easier). It is alright to not understand the problem, you don’t need to feel bad. I hadn’t understood all the problems in my first try either. Once all doesn’t work, look up the solution, and then code the answer without looking at the solution once you understand it.
  4. If you’re encountering errors in you’re program and aren’t able to identify them, make use of the ‘check50’ or ‘submit’. These two commands give a link once the program is run, and the information in the site which the link opens up is very helpful in solving errors.
  5. If you’ve still not been able to solve the problem set, take a break. Move onto the next lecture or problem set, and come back to the same problem set later.

--

--

A First Year UG Student studying CS. I like reading, writing and programming. I like self-growth and aim to live a fulfilling life.

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Yug D Oswal

A First Year UG Student studying CS. I like reading, writing and programming. I like self-growth and aim to live a fulfilling life.