What Programming Language Should I Learn?
September 01, 2021
3 min read
Last updated: September 01, 2021
Today I saw this video by a YouTuber called ForrestKnight on how many programming languages to learn, and whilst it is well-meaning, I think it really misses the mark on a few fundamental points. Before I start I want to clarify I don’t wish to single him out specifically, I think this is more symptomatic of most videos on this topic. The trouble is that I think that the kinds of advice people look for in a video is a quick takeaway “learn Java / C / Python”, which penalises a nuanced discussion.
I view learning programming languages as just a proxy for learning computer science concepts. It’s a means to an end, if you will. So the best piece of advice I can give is to start with the concepts you’re trying to build, and pick the language that will get you there.
The classic advice here is “pick for your use case”:
- JS for web
- Python for Machine Learning
- C/C++/Rust for systems programming
- Swift for iOS, Java/Kotlin for Android
And so on. This is good advice, but it’s incomplete advice. I’d argue the biggest pro is reducing that initial friction by:
- minimising the amount you need to get started - it’s targeted learning
- having a clear use case, so you know what you’re aiming for + acts as a source of motivation
Indeed that is why I would recommend JS as a good initial language for someone new to programming: websites are much easier to make than apps, and they’re tangible, so the learner gets quick positive feedback.
However, the caveat to this advice is when the language is particularly hard to learn. What if you want to build a game but that means you need to use C++? C++ is hard to learn because that initial investment you need is actually quite large: you need to understand about memory and pointers for one! If you’re interested, I’d recommend the following video (linked in the tweet):
And the second caveat is that through learning just for a use-case you learn the what without the why.
## Second language and beyond
I strongly believe that you should try to learn a second language once you’re comfortable with your first language, rather than diving deep into that first language. That second language I think is so crucial because it breaks you out of just accepting the idiosyncrasies of the first language. Remember how I said learning a language is a proxy for learning concepts - each language is a lens through which we view concepts.
JS for example has weird quirks like type coercion:
This is where I’d recommend learning a language that uses another paradigm, rather than learning just for use-cases. For example a functional programming like OCaml may not be used much in industry but the concepts you learn show up in other languages like
filter. The web framework React is built upon idea that we should write everything in terms of functions.
Another fallacy espoused by these videos is: learn C, because “C is the mother of all programming languages”. This is somewhat of a simplification. In C, you manually manage memory through pointers, which higher-level languages like Java and Python do not expose to you.
Does this mean that once you learn C, you’ll be able to use Java or Python? No, not really. C teaches you the concept of memory management, but you learn only one style of programming, procedural programming, as C does not have objects. Object-oriented programming, as in Java and Python, is a completely different mode of thinking, even though yes, you could technically implement objects from scratch yourself in C! In which case, you should write your own object-oriented programming language!
I feel like this is because C is probably the classic “rite of passage” that people giving advice on the internet go through as it’s one of the harder mainstream languages. Just because Python feels easier after C, it doesn’t necessarily mean writing in C taught you the concepts to learn idiomatic Python.
As I explain how I was able to get a grasp of Objective C half an hour in my learning Objective C snippet, once you start thinking about the concepts, you realise that languages often share a lot of concepts. This makes learning new languages much easier.
Once you’ve realised this, it’s not a case of knowing X languages, it is just a case of picking up whatever you need for your job.
And as to how you get there? Try to compare and contrast how different languages work. For example contrast objects in Python and JS. Read about why the designers of a language implemented it that way. Every time you learn a new concept, try to link it to previous concepts you’ve learnt.
Alright mini-rant over - hopefully it was somewhat useful!