Which programming language should you learn first?
Beginner programmers are often paralysed by the dizzying array of programming languages on offer. With so much choice, it can be hard to choose a language to get started with.
Some say that your choice of programming language doesn’t matter. And that learning to program is more like to learning to think than learning any particular language.
But this advice is misguided.
Making the wrong choice lead many to become discouraged and leave the pursuit altogether.
The right language, however, can make the journey to programming mastery all the more enjoyable.
What not to learn first
I remember when I starting learning to program during high school. My logic was that if I learnt the most difficult programming language first, then any other language would be a walk in the park. So after dabbling in Python, I started learning C.
This logic however is fallacious.
Learning to program in the hardest language is a lot like jumping to the top of the stairs so you can easily walk back down again .
There is already so much cognitive overhead in learning to think computationally.
Getting bogged down in unnecessary details like manual memory management, and manipulating pointers can easily lead to being discouraged.
What’s more important is maintaining motivation, having fun.
As Paul Graham says,
Young programmers are better off not starting with the theoretical foundations of CS, but by eagerly writing crappy programs.— Paul Graham (@paulg) April 21, 2017
What to Learn First
It’s much better to start simply and build on strong foundations.
So with this in mind, what is the best programming language to learn first?
Ruby or Python.
Because, their characteristics lend themselves perfectly for learning to how to think like a programmer without having to worry to much about the low-level details.
In other words, they let you ”eagerly write crappy programs“.
For example, Ruby and Python are:
- Dynamic languages- we do not need to worry about explicit types.
- Interpreted- do not need to worry about a compile step. You can run immediately.
- Strong ecosystem- large collection of Ruby Gems and Python packages.
So despite what Harvard may say, C is not the best language to get started with.
Get started with Ruby or Python.
Then dive lower in the stack.
You’ll be a happier programmer for it.