Two Ways to Check If You Completely Suck at Programming
By: Byron Dolon
Tags: Software Development, Learning To Code, Technology, Programming, Data Science

PROGRAMMING

Two Ways to Check If You Completely Suck at Programming

Because you probably don’t.

Art by siscadraws

Learning to code is hard.

I’ve gone through countless YouTube videos, online courses, and personal projects. Yet somehow, I feel like I’m no further along than when I started.

As I continue reading articles on programming, data science, and cloud computing, it’s hard not to feel overwhelmed and intimidated by the cool stuff everyone else is doing. Even looking at the Python subreddit makes me wonder how people who have only been learning for a few months can build such complex projects.

I started the CS50 course by Harvard, which I would highly recommend to anyone looking for an introduction to Computer Science. After every lecture, you’re tasked to write code to solve an assignment based on that week’s topic. I recently finished Week 3 on “Algorithms” and completed the second assignment.

It took me almost six hours.

When my code finally passed all the tests, I was more relieved than ecstatic. Staring at a seemingly simple problem and not knowing how to fix bug after bug for so long made me question whether I even had any problem-solving skills to speak of. I also wondered how long it took others to solve. Surely most people (from students of Harvard to the thousands of enrolled in the online course) didn’t need to spend half a day on one assignment.

Thankfully, before I spiraled into a black hole of self-doubt (mild exaggeration), two events put me back on track. They helped me realize that while it’s great to always want to learn more, it’s also important to believe in your abilities so far. You might be further along than you think.

Let’s dive into the two things you should do to check if you suck at programming!

1. Build something for someone

I recently looked at some code I wrote for work a few months ago and thought “wow, this is bad.” I shook my head and started to untangle the mess of functions and variables I’d created, wondering all the while why I didn’t add more comments to it.

My girlfriend saw me grumbling to myself as I typed away and asked what was wrong. When I told her that my code sucked, she asked, “Does it work?”

“Yeah, it works, but it’s so messy and I barely remember how I wrote this in the first place.” I said.

“Well, you’re already almost done fixing it now, so that means you do remember.” she replied.

Then she asked again:

“Does it work?”

It’s a simple question, yes, but it can reveal so much. First, I will preface the rest of this section by saying that yes, it’s important that what you build is built well (scalability, readability, avoiding deep nesting, DRY, etc.). I’m not saying that you should be happy if you write garbage that technically fulfills its intended function.

However, if you what you built serves its purpose and isn’t completely confusing when you need to explain how it works, you should be proud!

This brings me to how you can test your programming skills by building something for someone. There’s an incredibly satisfying feeling that you get watching code you wrote help someone else.

My girlfriend recently needed to translate text from PDF files. However, the PDFs she’s working with are scanned images. She can’t actually copy any of the text, so she’s had to manually type paragraphs into Google Translate. Also, since she only needs a few paragraphs of the PDF translated, using an online service that would translate the whole document (or even a page) wouldn’t be very helpful.

I saw what she was doing and thought to myself “Hm, I could probably help with that”.

I then wrote a really, really simple CLI application for her that would take an image as an argument, get all the text from the image with pytesseract , then copy that text to the clipboard.

Typing paragraphs into Google Translate isn’t a hugely time-consuming task. With that being said, even if I’ve only shaved off 30 minutes of her work every day, that’s still an extra 30 minutes of her life that she gets back!

Identifying a solution and building it to help her, strangely enough, helped me realize that all my learning so far isn’t confined to my head. I could actually use it to make other peoples’ lives better.

And you can too! Look around to the people close to you, whether it’s your family or colleagues, and I’m sure you’ll be able to find something that you can help them automate. Being able to think of and develop a solution, even if its one for a trivial problem, is programming.

2. Teach something to someone

This is advice that you’ve probably seen before. Teaching someone a concept you just learned is a great way for you to retain information. This is because it’s impossible to teach without first understanding the subject. If you try to teach someone a new concept without having mastered it, you may be able to recite a basic summary, but you won’t be able to answer any of their follow up questions.

I first learned about list comprehensions in Python a while back and I’ve used them in various scenarios since. However, I only really knew that I understood them when I helped my girlfriend with one of her scripts.

She was looking for a way to automate moving files into different folders based on part of the filename matching a folder name. She first wanted to create all the folders based on the filenames. For example, a file called 12345_file.pdf was in the directory, which meant that she needed to create a folder called 12345 .

To do this, she wanted to implement a for loop to get the first digits of all the file names and put them in a list, then loop through that list to create all the folders. However, there were some cases where some of the first digits were duplicated. There could be another file called 12345_newfile.pdf , 12345_oldfile.pdf , and so on. This would lead to a list containing duplicate values, which would not work.

To simultaneously avoid using for loop to create a list and remove all duplicates from the list, I wrote this for her:

folder_name_list = set([i[:5] for i in original_filepath_list])

We already had a list of the file paths, so I explained to her that you could use a list comprehension to create a list. You could define the components of the list and any conditions for it using a list comprehension instead of making an empty list and looping through and appending new elements to it. In this example, I would take the first 5 characters of each element in the existing list of file paths. Then, to remove all duplicates from the list, I just converted the list into a set, because a set in Python cannot have duplicate values.

Going through that process felt great because:

Removing duplicates from a list is an incredibly common task, so being able to explain how to do it quickly and without looking anything up meant I had really practiced doing it enough. Being able to explain a (relatively) more advanced operation like list comprehensions meant that I was doing more than just concatenating strings and stuff. I got to help someone out again! I watched as someone learned something new and got to implement it in their own code, which meant that my learning resulted in a positive tangible impact in someone else’s life.