Learning New Programming Languages and APIs – What I Was Doing Wrong

Note: I originally posted this article on a personal blog I ran when I was in my late teens and early twenties. I discovered in May 2020 that the Internet Archive had preserved the contents of that blog in its entirety, including some of the media. That blog was an important part of my personal history, so I reposted all of that content on this website for archival purposes. While my politics, opinions, and outlook on the world have changed radically since I wrote those posts between 2009 and 2011, it’s good to know that I was as much of an idiot then as I am now.


For the past few months, I have been trying to learn how to write GUI applications for the Mac. The two best toolkits for this task are Cocoa and Qt. Since I have never written any GUI code before and none of my projects have ever been very complex, learning these two libraries turned out to be a tough nut to crack. After many months of trying to become proficient at writing GUI code and failing, I have finally found out what I was doing wrong all this time. The fact that I have finally grasped Qt using my new methods is proof that my old methods had some very serious flaws. The following points are written in context of learning new APIs and languages, but they apply equally well to anything else you might ever want to learn.

Hand-Holding Doesn’t Get You Anywhere

What I Did Wrong: I looked for a book on Qt which made understanding GUI programming concepts simple for a beginner such as myself.

Correction: Such a book does not exist. Picking up a For Dummies book (or something equivalent) means shooting yourself in the foot. If you expect people to guide you step-by-step through learning difficult subjects, you should probably not be writing code at all.

Immerse Yourself in the Material

What I Did Wrong: I searched hard for a book that would teach me Qt from beginning to end. I spent hours reading reviews, blog posts, forums and back covers searching for the One Book.

Correction: One source is never enough, and the One Book does not exist. The best way to learn any new API or language is to completely immerse yourself in the material. Subscribe to mailing lists, hang out in IRC channels, read blog posts, articles and tutorials, help people out at StackOverflow, read code written by the experts, try to modify existing code, add new features to your favorite application and talk to people who know the stuff well. Oh, and buy a good book.

Don’t be Systematic

What I Did Wrong: I tried to systematically study the material from the first chapter to the last, completing every exercise given in the text.

Correction: Being systematic is the biggest mistake I made while learning Qt. Trying to be systematic will only tire your mind as you tediously work through some trivial exercise the author thought was important. Programming is a creative activity. The most painless way to learn something is to just let your brain run wild. Speculate, dream, design, experiment. Skip the boring exercises and do only the ones you find interesting or, better still, make up your own exercises. When you find yourself unable to complete the task you put yourself up to, skip around the book and try to find a way to solve the problem.

Taste Things First

What I Did Wrong: As I read through the material, I typed the code samples into my editor to see what the author was trying to say. I moved on to the next chapter only when I had tried out every code sample and completed every exercise in the current chapter.

Correction: When you’re reading through the material for the first time, always read it like it’s a novel. Instead of focussing on how you can accomplish a certain task, focus on what you can accomplish. This way, you will know the strengths and weaknesses of your tools before you sit down to code. Most importantly, you will know where to look for the functionality when you actually need it. Reading the material quickly makes it seem like you’ve accomplished a lot in very little time which keeps your brain from getting bored. Also, it makes reading through it the second time (this time focussing on the details) much easier.

Aim High

What I Did Wrong: Whenever I didn’t understand something, I told myself it was okay. Whenever I felt stupid because I couldn’t grasp a simple concept, I told myself to relax. I thought it was okay to fail, and that not many undergrads even know about Qt. Hell, I thought, there are so many great hackers who didn’t even know how to program at my age.

Correction: When you’re evaluating yourself, always compare yourself to the people who are better than you. If you think you’re stupid, you probably are.

These techniques were partly based on this article. Check it out, it’s pretty good.