In this article, I will share my thoughts on choosing your first programming language, what it means to “learn to program,” and what you should learn if you want to become a programmer as quickly as possible.
Starting to learn programming is hard and easy at the same time. Easy, because now you can find a wide variety of tutorials and videos for beginners. Often they are free. The first tasks and theory may seem very simple and logical.
Also, it is difficult. Because it can be extremely tough to choose from a whole variety of materials. There are too many on the internet, and it’s difficult to distinguish independent reviews from custom ones, especially for a beginner.
In addition, most often, free tutorials are only good at first. They are rarely thought out from a methodological point of view. They rarely have many well-chosen coding tasks, and there is seldom a way to ensure your code is good and correct.
It turns out that it is even more difficult to continue than to start. There are a lot of free materials from scratch, but the further you go, the less there will be.
In addition, it is difficult for a beginner to answer the question, what is it like to learn to program? If I’m asked about it (or even if I’m not asked, meh), I usually give my students an answer like:
Learn how to perform certain tasks using code (how the computer and the programming language itself “thinks”).
Directly get the knowledge you need for future work.
The first point is quite general. It doesn’t depend on the language (although it still does, I will give a small example later when I write about Python), and absolutely all potential programmers need it. The right approach and good mentors (or thoughtful courses) let a beginner start to master all the necessary techniques along with the language's syntax from the very first tasks. Among these tasks are replacing two numbers, finding the maximum and minimum, calculating the factorial of a number, and other simple algorithms.
Working out these tasks at the very first steps of your learning is very important. It’s like regarding the proper position of hands for a novice pianist: you can play without it for a long time, but it’s much easier and more effective to solve this issue from the beginning.
Next among the universal problems are algorithms and data structures. There are many disagreements about this topic. The fact is that much attention is paid to algorithms during training, but in real work, you don’t have to implement standard algorithms or data structures. They have long been implemented in the best possible way in all more or less popular programming languages.
Therefore, most often, potential programmer encounters them only during their studies and during interviews. I mean algorithms like sorting and searching for elements in lists or arrays, or your own implementation of data structures, for example, stacks, queues, trees, sets, lists, and so on.
Let’s say in Java, you can find all these data structures in the Java Collections Framework, and among its methods are the best implementations of the algorithms. The same is true for other popular languages. However, if you want to become not just a coder but a really good programmer, I recommend paying close enough attention to algorithms and data structures.
This is very useful for understanding the “thinking” of a computer and the organization of processes in it. If you become well versed in these topics and carefully work through them in practice, I guarantee you will gain a huge advantage over those who have not. Specific knowledge of a particular language or framework becomes obsolete, and the way of thinking that forms the work on algorithms will remain with you forever. And it will come in handy many times at work and in interviews.
The second point (directly obtaining the knowledge you need for future work) depends on what you want to do in the future and is more tied to the field and language you plan to study.
Now, let’s look at how to choose a programming language.
The choice of language depends on where you want to work. Unless, of course, you have already formed preferences. When I ask what a person would like to program, I hear many answers. Here are the most popular ones:
Here are short answers to give you an idea of which language you should use based on what you want to create:
These are general recommendations; they’re not universal. Games in the browser, for example, can be written in JavaScript, and no one is stopping you from creating an operating system in Java.
Next, let’s look at how useful choosing will be.
However, most often, I hear very different answers to this question:
They said that language does not play a special role in this case. Sometimes, at the beginning of learning how to program, it’s good to learn the basic algorithmic principles, not use a specific language, but focus on schemes and generalized pseudocode that’s understandable. In this case, learning does not depend on language.
However, modern programming languages are quite clear and logical. If your goal is to find a job as quickly as possible, starting immediately with useful knowledge and a language applicable to work is better. So it makes sense to simultaneously study the language’s syntax and solve the first coding tasks and implicitly learn how the basic constructions of the language and the simplest algorithms work.
In the past, schools often started with Pascal, a language specially designed for learning. It’s a good language with a clear structure that helps to understand the basics of procedural programming and is even a bit object-oriented. However, it is not used in practice (with rare exceptions). So deep learning of Pascal is a waste of time.
Today, schoolchildren are often introduced to programming in the visual language, Scratch. This is a very nice tool and, I must say, quite powerful. But it is needed specifically for studying and creating educational projects. It is unlikely that you will need it in your work (unless you want to join the team of its developers … well, or teach programming to children).
If a person doesn’t yet know what exactly they want to do as a programmer, it makes sense to choose one of the popular universal programming languages. “Universal” means that it can be used in various fields and types of programming. If you look at the list from the previous point, you will see that several languages are repeated quite often. These are Java, Python, C#, and C++. Perhaps all of these languages, except for C ++, are suitable for beginners.
Remember, I said that the first thing to learn is a language that is frequently used and not too difficult. So, C++ is a very powerful and complex language that allows professionals to create almost anything, and the program will be effective. However, when used ineptly, the same tool allows you to “shoot yourself in the foot.”
In short, if you want to create high-performance applications or AAA games, you need C ++ …, but not immediately. It’s best to learn one of the other three languages I’ve written about first.
Today, universities and high schools often choose the Python language for beginners. It’s a smart choice because Python has a low barrier to entry. It has a simple syntax, and the structure is such that you do not need to pay attention to several things you must control while programming in other languages.
Everything would be fine with Python, but there are several features. If you don’t know whether you want to be a programmer but want to try (or need to learn) programming, I recommend Python. But if you want to be a programmer shortly (and not sure about making websites or science programming), I would not recommend Python for methodological reasons.
The fact is that Python has a lot of syntactic sugar, that is, constructs that make the code concise. It would seem that this is good. However, I have learned that this very sugar sometimes hides the essence of simple actions that a novice programmer should have understood from the beginning.
Here is an example. One of the first tasks, which somehow explains to the student how computer memory works and what programming logic is in principle, is the exchange of two variables in places.
a = 5
b = 7
We need to swap a
and b
. Usually, this problem is solved with the help of an additional variable. Along the way, a competent tutor will explain that a and b are names that refer to memory areas where the values \u200b\u200bof
variables are written (or a little differently, depending on the language).
Usually, it is solved like this (in any language): imagine your values are in two containers, a
and b
. For the solution, a tmp
buffer variable is created, that is, a third temporary container.
In the first step, one of the values is transferred to it, for example, 5
. Next, the value from b
, that is, 7
, is put into the “freed” container a
, and then the variable is transferred from the temporary container to container b
. Here’s what it looks like in pseudocode. Please note that the =
sign is not equality, but an assignment operator (it is the same in almost all programming languages).
a = 5
b = 7
tmp = a
a = b
b = tmp
Now the tmp
variable has done its job. Variable a
has 7
, and variable b
has 5
. This simple task is very important to understand well from the beginning of your path as a programmer. Approximately this problem is solved in any programming language.
This problem can also be solved using two temporary variables:
a = 5
b = 7
tmp1 = b
tmp2 = a
a = tmp1
b = tmp2
Nobody bothers to solve it like this in Python. However, syntactic sugar allows you to write the solution like this:
a, b = 5, 7
a, b = b, a
That’s it, the task is solved. There is also an exchange here, and there are temporary variables (most likely, even two), but who will solve the problem in the first two ways if it can be solved briefly like this? And that’s great. But many important aspects for understanding the essence of programming with such a decision slip away. And there are a lot of such examples in Python. And that’s why I wouldn’t recommend Python as your first programming language if you’re learning independently.
If a person learns to program with a competent teacher, they will most likely ask the student to solve similar problems in a first way and later show this Python feature that makes it so attractive. In addition, there is one more thing, after Python, it will be quite difficult to learn other languages with a less concise syntax.
However, Python is generally a good choice. It’s versatile, but here’s where it’s used most often:
Java is taught in so many universities that specialize specifically in IT. This language is not without flaws. Let’s just say, it is quite verbose. Especially when compared to Python. However, its logic is quite easy to understand, and it is closer in complexity to medium or even simple languages. It is important that it will be easy to learn simpler languages (like Python) and more complex ones, like C ++.
Java is a universal language and works on all platforms where there is a Java machine. A Java machine is a virtual computer, a layer between real hardware and the programmer’s code. For almost any platform, from a coffee grinder to a supercomputer, you can create a Java machine and write programs in Java.
And if there is no Java machine on some platform, this is most likely due to marketing and agreements and not the inability to create one. By the way, not only does Java work on the JVM, but also other popular languages, such as Kotlin. It is more difficult for a beginner to learn them than Java, but they go very well after Java.
I recommend Java for beginners. It is very popular, well-documented, and quite simple, but the main paradigms will not be hidden from the eyes of novice programmers.
Like Python, Java is a general-purpose language. However, there are traditional strengths even for general purpose languages:
I won’t talk about C# for a long time. This language is very similar to Java. It was created as Microsoft’s answer to the advent of Java. They have almost the same advantages and disadvantages, only Java is somewhat more popular. Perhaps I recommend learning C# if you decided to engage in game development.
This language supports one of the most popular game engines, Unity, as well as the growing power of Godot. You can do mobile and indie projects on these engines and large projects. For everyone else, I recommend sticking with Java.
Since I consider Java the best programming language for beginners, it is on its example that I will describe what I consider necessary to learn. This is what Java knowledge consists of:
Core Java. As you understand, this is the basis of the language, its main structures, and libraries. Below is a short list of what you need to know very well today if you want to apply for the role of Java junior developer or trainee.
As I said above, I highly recommend taking some time to break down algorithms and data structures and write your own examples. This will greatly help you stand out from the many Java junior applicants. This point often distinguishes an IT university graduate from someone without technical education.
Since these algorithms have been discussed many times, books can be used as a guide. For example,
This point is not about programming in general, but a good knowledge of the working tool, which is libraries and components. I recommend you study all this only after Core Java and algorithms, or, if you are in a hurry, simultaneously.
Learning these tools on your own is very difficult. And some time ago, no one demanded their knowledge from those looking for their first job. However, times have changed, and requirements have grown significantly.
Learning to work with them on your own is difficult, although possible. However, in this case, I would recommend finding courses and doing them with a mentor.
The best way to learn Spring and Hibernate is to find courses with a small team and a tutor, but that’s not always possible. I’ve found some interesting resources for learning them. Give them a chance.
Design patterns are well-established solutions for solving specific problems. If a newcomer knows, it will be easier for him to join the team and start working. Otherwise, you will have to study them quickly at the workplace.
Therefore, before sending out a resume, I recommend you take the time to read about the templates and put them into practice. It’s the same story with architectural patterns like MVC. I always ask my students to create some programs using MVC. Even a very simple task is complicated with MVC, but then they know how to use it. And, if for small tasks the use of templates is a headache, in large projects, they are salvation.
It would also be useful to read about simple and well-read code, according to the principles of KISS, DRY and SOLID. To be honest, they are easy to understand, but putting them into practice takes time.
Where to learn and read about patterns and principles:
Also published here.