How to teach (yourself) computer programming

Disclaimer: This is my experience with CS classes in high school, in Romania. Your experience might vary. If you happen to be a teacher in the said system, please note that I am not targeting you directly. I am describing both my own and others’ experience.

I happen to be studying at a computer science-oriented high school, where I have 7 hours of CS a week. That’s about one fourth of the total time I spend at school.

Many fellow students are likely in the same boat, the only difference being that the vast majority not only that don’t list computer science as one of their passions (but more as one of their reasons for not wanting to live anymore), but they get a very distorted view of what computer science and programming actually is.

Said CS classes tend to be kind of a joke, not only because of the curriculum. The main reason why they are bad and boring is the way they are taught. I am going to address my main frustrations on this matter together with proposed solutions and a guide for those who want to start learning alone.

Status quo

Right now, the usual CS high school class happens in either a computer lab or a normal classroom.

The most simple case is the normal classroom. Ideally, the teacher should teach the theoretical part of computer science, algorithms and data structures, that is. The only materials are the (optional) textbook and the whiteboard. The teaching should consist of presenting the idea of an algorithm or a data structure, what problem it tries to solve, when it should be used (both are very important pieces of information) and possibly a comparison with other solutions to the problem. The courses go from most simple to more complex, each further course usually requiring knowledge from previous ones.

However, this is the ideal scenario. The reality is usually worse.

Students receive poor teaching in these basic lessons in computer science, with seemingly meaningless information that isn’t correlated to any useful use case. The lost student might wonder “OK, so this problem asks me to take an undirected graph and remove the nodes that contain prime numbers. What do I do with it?”. The answer is usually “this is your homework and you have to learn how to do this for the exam.”.

Isn’t a more specialized high school class meant to teach the elements of the subject to the student so he or she might be inspired to purse it in their career? Those 7 hours a week of computer science are the direct result of the student choosing a “maths-cs” programme when enrolling in high school.

The computer science class is a time sinkhole where students are required to learn how to implement completely theoretical algorithms for no apparent reason. That is the fault of the curriculum. One might argue that those lessons are key to learning how to program in any situation, especially in the “real life”. But how are you supposed to learn, or just get a glimpse of how programming really is like, when the time allocated to do so is filled with the robotic studying of, how should I call it, applied maths? Yet it is not applied onto anything.

What makes this experience much worse is that the teachers themselves don’t make this any better. The class can either be:

There are students that say “Why do I need computer science in my life? It’s useless! I shouldn’t have to remember all this crap!”. The same students that enrolled in the “math-cs” class.

There are cases of students that actually enjoy this theoretical aspect of computer science that is taught in school, albeit limited, and usually in the OK or ideal case. But the case should be in reverse, when there are limited case of students that don’t like the CS class. These students worked hard to get to a more capable school with intensive CS programme, and to have good grades, because the math-CS programme is arguably the hardest. They should find satisfaction in this class when they worked so hard to be able to attend it, not repulsion. The class should teach them the very basics of computer science and software engineering, studying algorithms and their practical applications together, just like in a typical programming book that you would find today. Besides, some of these theoretical lessons may not work that well in practice, such as linked lists. Here is the creator of C++ telling you why you should not use linked lists. Even Rust’s standard library’s documentation says so.

Even the actual tech stack is so far away from reality. They call it “C++”, but they don’t use any of the “++”. The only excuse is the std::cin/cout combo, because printf and scanf aren’t “friendly enough”. Yet not only do they use a pretty low level language, but the chapter about strings is completely about C-style strings (with null terminator at the end) and the string functions from string.h, including the dreaded strtok. Yes, you read that right (in case you didn’t know it, go read about it. It’s horrible). And as a trivia, most teachers in my experience teach declaring constants using #define instead of const, which is even more ironic, considering that C macros are even harder to wrap your head around than basic C++ consts.

I’m not saying that higher-level programming languages (such as Python, or Java) should be taught instead of lower ones. I only suggest that the tech choice is insanely hypocritical. In fact, I actually do encourage learning these theoretical algorithms with C. What I really want to see in a better CS curriculum is learning a high level programming language alongside to easily write some practical programs like web backends or simple games, using libraries like Pygame. The time that is currently used to teach more complex algorithms and data structures should be instead used for practical applications, so students get to learn how code really gets transformed into something they can use or they can play with. Because, in the end, if they pursue such a career, that’s what they’re going to do, just way more complex. I am not particularly fond of these languages, but it makes showing practical stuff to students much easier. Leave the complex theory to the university. They are going to teach it from the beginning either way.

I will not go in the topic of poorly prepared teachers. It’s expected when teachers’ salaries are so low that pretty much nobody wants to become one, especially computer science graduates that can make a lot more money in programming than in teaching.

How you, the victim, can overcome these limitations

They say computer science / programming / engineering is learned at home. They are not wrong.

I described my still ongoing way in the previous post (it probably surely needs an update). I am going to describe here a potential way that a prospecting CS student, or just someone that is interested in learning computer science, might take on to learn. There are victims of the system described above that still want to learn real programming, dizzy from all they have to endure during classes, who don’t know where to start or how to continue.

Like with any other goal in your life, including being alive in its own way, you must set some clear, manageable goals. These should be of the form “By the time spring comes, I will have a console-based snake game coded in C!”, “This month I am going to learn some Python”, “by the end of the next year, I will learn 2D OpenGL programming”. As long as you have one small, clear goal, that you can manage to complete, you are golden. You are not required to fulfill it in time, other life events might ensue. Don’t be let down if you can’t do it. It is your goal, you can move it anytime you want. As long as you have a target, the drive to achieve it is going to be natural. Just make sure to set a new goal after completing the previous one.

Of course, this requires the mighty value of discipline. Work on your discipline and self-esteem if you know that you have issues with that! Succeeding in completing these goals might help!

As a starting point, take a programming language (C, Python, Java, Go, Rust…) or a game engine (Unity comes to mind) and look for courses organized by volunteers around you. Check at your local universities, if you happen to have one. These kinds of courses have a set roadmap and structure, making it easier for clueless you to start. Alternatively, you can look for a book for that piece of technology. An example for Java is Head First Java, which is a classic. Such speciality books, released by publishing houses such as O’Reilly, Packt Pub, No Starch Press etc are written by experts and are well structured.

By the time you’ve gained traction, you may delve into “the good stuff” part of the learning material, such as The K&R, The Red Book, The Dragon Book etc. You will start to watch technical talks about bits of tech that interest you (examples: “OOP Is Dead, Long Live Data-oriented Design” by Stoyan Nikolov, “Preventing the Collapse of Civilization” by Jonathan Blow) along with the study of open source code. Studying code has never been as easy as it is today, when we have countless high-quality open source software driving our tech. Although controversial, much of it is centralized on GitHub, which is a site that also encourages contributing to these projects. Its first motto was “Social Coding”.

Get involved in online communities to learn from them and to ask questions, such as forums, subreddits (there is /r/learnprogramming, a sub that welcomes questions from everyone), IRC channels (especially those of open source projects, you can find some on freenode), Discord servers etc.

And as always, thank you for reading, and have fun!