You can become a programmer without a formal computer science degree. Around 30% of software developers are self-taught. But you would probably want to know which language to learn first. After all, there are many of them out there.
Well, the answer to this question is simple enough if you are learning on the job. Just learn whichever language you need for that specific job. But what if you don’t have a programming job yet and you don’t know which specific language you will be working with in the future?
Well, in this case, you need to remember that it’s always harder to learn your first language than any subsequent one. Even though different languages differ in syntax, all of them still share the fundamental concepts, like conditional statements, loops and so on. You can write similar algorithms in different languages. This is why, as long as you already know at least one language, you will only have to learn the syntax of the new language but not the fundamental principles behind it.
If you don’t have a specific language to aim at and ask for advice online, you will usually trigger a language war. Some people will be saying that you should choose Python. Other people will recommend C/C++. Based on my own experience, there seem to be more people in the latter category. C and C++ can be lumped together, because C++ is nothing more than extended version of C.
Today we will examine pros and cons of each approach. And you will see why Python is probably better.
C++ or Python?
Both C++ and Python are highly popular. And they have been popular for many years with no sign of decline in popularity. Therefore, if you learn either of those, chances are that you won’t even have to learn some other language to get your first job.
However, as far as general-purpose languages are concerned, Python and C++ are on the exactly opposite ends of the spectrum. C++ is a highly complex mid-level language. By “mid-level”, I mean a medium level of abstraction. It doesn’t consist of pure CPU instructions. We have assembly for that, which you will probably never have to use directly. But you still have to do a lot of low-level things yourself, like ensuring that the memory is freed after you no longer need it.
Python, on the other hand, is a high-level language. All you do in it is write the logical flow. The engine that runs the language will do everything else for you. You won’t have to worry about the hardware resources as a developer. Therefore it is much easier to write a program in Python that it is to write an equivalent one in C++.
Another advantage of Python over C++ is its fundamental principle that says “There should be one– and preferably only one –obvious way to do it“. Because of this, the syntax of Python doesn’t consist of as many components as that of pretty much any other language. It’s very small. C++, on the other hand, have different keywords that achieve broadly the same thing. For example, there are several different ways of achieving the same flow control by using different conditional operators and different types of loops. And this fundamental difference makes Python way easier language to learn than C++.
But you will often see developers arguing against learning Python first. They would say that the factors that make C++ hard are the reasons that you will become a much better software developer if you learn it first. According to them, a Python developer would cry if he or she would have to then learn C++. But a C++ developer would breath through learning Python. But is this statement really true? Let’s find out.
There is no empirical data that says C++ is better
The argument that knowing C++ will make you a better developer overall seems logical. But there is no real empirical evidence to support it.
I can only rely on anecdotal evidence. But based on my personal experience of interacting with many C++ developers, there are just as many bad ones out there as there are good ones.
There are C++ developers who don’t know basic best practices of programming, such as SOLID principles. There are plenty of C++ developers who write unreadable and buggy code. And there are plenty of them who manage to learn another language, but keep their bad habits. In this case, the code written in new language is just as bad as the code they used to write in C++.
But likewise, there are C++ developers who are genuinely good at what they do. They write clean code in C++ and they write clean code in any other language that they ever need to learn.
Likewise, I knew developers who had to learn C or C++ at late stages of their career. And they had no problem with that. Even though C++ happens to be harder than the languages they already knew, their accumulated knowledge and experience made it easy for them to learn it.
So, while the argument that learning C++ as your first language has some merit, there doesn’t seem to be any actual real-life evidence that this is the case.
My own experience with C++ and other languages
And I’m not expressing my point of view as someone who have never learned C++. I have learned it a while ago. I went through all fundamental parts of its syntax. But I have now forgotten most of it. This is because I never had to use it. And the stuff that doesn’t get used tends to be forgotten.
For me, C++ wasn’t the language I’ve learned first. The first one I’ve learned was Visual Basic (VB). First, in the form of VBA. Then, in the form of VB.NET. Even thought it wasn’t as simple as Python, it’s still a beginner-friendly language. And this is mostly because VB looks almost like plain English.
C++ is a language I was learning in my spare time alongside Java and C#. The reason why I’ve chosen to learn those two was because, at the time, they were among the most popular languages. And the thing is, even though I found C++ somewhat more difficult compared to VB, it wasn’t extremely more difficult. I still managed to get a reasonably good grasp of it within a couple of months.
But then C# became my main language. And since then, I haven’t encountered a single situation where I needed to use C++. Granted, the names of the languages sound similar, but the languages are completely different from each other. Unlike C++, C# is a high-level language. And it’s much easier to use.
So, based on my personal experience, it doesn’t really matter if you have chosen a beginner-friendly language as your first language. You will still be able to learn C++ relatively easily if you need to. It’s only the first language that you learn that is hard. Any language you learn after this will be easy to learn.
The real reason why people tell you to learn C++ first
If you have a look what kind of people recommend C++ as your first language, you will notice that it’s almost exclusively computer science graduates. And it’s not necessarily because they know better. The main reason why C++ is the language that they recommend is because they have been taught this way.
C and C++ are the main languages that many universities teach. And it’s been like this for decades. One reason for this is because university degree programs don’t tend to change as quick as things do during real-world industrial innovation. And the other reason is that there is really no need to change it.
C++ is still one of the most popular languages. And the argument that it’s an easy gateway to other languages still holds true. Knowing C++ certainly won’t give you any disadvantage compared to knowing any other language.
So, when you hear someone insisting that C++ should be your first language to learn, they aren’t lying. But chances are that the only reason they say that is because they were taught this way.
Why Python is much better for a beginner
But being a good programmer is not only about knowing a programming language well. Being a good programmer is also about being efficient. This is why you would be asked to learn algorithms and design patterns instead of always coming up with your own solutions from scratch.
And learning C++ as your first language doesn’t happen to be the most efficient thing you can do for your career. Unless you are specifically aiming to work in a niche where C++ is heavily used, learning C++ will just fill your head with a lot of useless information.
Even though C++ is a general-purpose language, it’s not as general-purpose as any other high-level language. The fact that it’s so hard to write code in C++ is the reason why it’s not used unless it absolutely has to be used. You won’t be writing either a mobile application, desktop application or a website back-end in it.
You will, however, use it to write device drivers. Or gaming engines. Or embedded device firmware. Or high-performance modelling software. And this is because those things that make the language hard are also the things that allow developer to write high-performance software that runs close to the bare metal.
But if you don’t aim at these specific niches, learning C++ will just delay you, because you will then have to learn another language anyway. So why not to just choose one of those languages to start with? And Python just happens to be the easiest one of those to learn. Because Python is so popular and it’s a true general-purpose language, there will be plenty of opportunities to choose from once you master it.
Do you know why data scientists choose Python as their main language? It’s not because it happens to be the best language for data science. It’s actually because data scientists are mathematicians rather than software developers. Python just happens to be the easiest language to learn.
But despite being relatively simple, Python still has all fundamental components of any good programming language. So, once you learn it, it will still be easy enough for you to learn any other language later.
So, even though both C++ and Python are good, unless you are specifically aiming at a job in embedded software development or game-dev, you should probably choose Python. There is no harm in learning C++, but Python will allow you to become a competent programmer much faster.
Even though the argument that knowing C++ will make it easier for you to learn other languages in the future, there is no actual evidence for it. Observations indicate that, regardless what language you choose as your first one, the second language will always be much easier to learn.
But overall, if you don’t know any programming language yet, you should follow this algorithms to decide which one to learn:
- If you know exactly which language you will be working with – learn that language.
- If you don’t know yet – just learn Python.
Remember that it’s not the knowledge of any specific language that will make you a good software developer. It’s knowledge of how to use the language well that will do so. So, even if you have an encyclopedic knowledge of C++ syntax, you will still be a pretty bad developer if you don’t know how to actually write a easily readable, well-maintainable and bug-free code in it.