What programming language should a beginner learn in 2017 - 20XX?
If you're looking to learn how to code, the sheer number of programming languages may be overwhelming - what language should you indeed learn? Did you know you could make a children's alphabet book out of all programming languages listed in the Wikipedia and it would have good chances to be unique to someone else's alphabet book made out of programming languages?
There are people constantly coming up with new programming languages. Think about it: You could learn all the programming languages and when you are finished, within the next hour someone would come up with a new programming language and you would no longer know all the programming languages. This is futile, why learn any language at all?!
Static vs Dynamic typing (or anything!)
There is a big debate that has been ongoing at least since the year 2000 and there's no end in the sight: How static and dynamic typing compare with each other? You really cannot miss this one when studying the subject, so I provide and introduction and then explain why it doesn't matter.
The first concept to understand is the idea of a type. A type in programming describes how some value can be used, what does it represent, and how that value is represented by a computer.
In a programming language you usually have a some concept that holds...
- numbers without a fractional part, eg. int,
- text and fragments of it, such as string,
- numbers with a fraction, restricted to some range of precision allowed by binary numbers, eg. float
When a computer works through the program, it has to know precisely which operation it carries through at every point in the program. To do this, it has to resolve the type.
- In a statically typed program, the type is resolved as early as possible. At extreme it happens before you write the code.
- In a dynamically typed program, the type is resolved late as possible. Eg. Just before the program is going to do the operation.
Statically typed programs can be optimized to the point that you get near to the peak performance you can obtain from the computer. But many other claims thrown up do not usually hold.
Static typing proponents tend to argue that static typing increases the correctness of your program. They tell you about "type safety" and how the types you wrote can catch the errors you wrote.
Another one commonly said is that static typing helps in code refactoring and enables code autocompletion with a tab key in an editor.
Also sometimes you hear that static typing would make applications more scalable. New claims likely will keep popping up. Please ask for evidence before you believe anything that involves static or dynamic typing.
If you do programming for a long time, you will be surprised how easy it is to write a program that doesn't indicate on any obvious metric that it is false, yet despite that it doesn't do what you meant it to do. You stop believing that a computer can recognize correct programs from incorrect ones.
Your understanding of the subject the program tackles is the limit. Dynamically typed programs usually take the shape of pseudo-code - the code used to teach programming concepts to others. Therefore the use of dynamically typed programming languages may improve your understanding of the subject and help you write the program correctly.
The price you pay for that is that occassionally your program stops to a type error when it runs. And you can usually write some really horrible programs dynamically that would be impossible to write otherwise. And that if you ever need to obtain the peak performance from the computer, then you need to switch into static typing once in a while.
Now when that's out of the way, we can start with the main advice.
The programming language you should start with
The language you should start with should be such that you can quickly write up something and have it run.
At the past days this kind of language was the BASIC. Today BASIC is irrelevant. During the 2000-2020 it was the ECMAScript. The language picked by popularity or availability is not usually the best. It's not even often good at all. Do this to get your feet wet.
You don't need to stick to it for long, just long enough that you get your first programs written and get used to working with computers, pick a good text editor, and so on. Choosing your first programming language would be just an another obstacle in learning, so don't do it. Let the circumstances choose it for you.
You might have known this already, and were seeking an easy way out. But in this case the hard way is the easy way out. Stick with it!
When you choose your second programming language, you won't be a beginner anymore.
How to enjoy programming
Programming can be a grit that you grind until the client is happy. When you make a work out of it everything cannot be fun or nice.
Programming is also an infinite source of puzzles that appear when you try to get something done. Some are solvable. Others are so hard that you have to look for a solution before you can figure them out.
Once you've exhausted all possibilities, you sit down and keep on your things until it flashes and you've figured out how to solve it.
That act of solving puzzles for practical reasons. It's a fun part of programming. You get to tolerate everything else for those one-off experiences.
(For the usual readers, I am looking into the "why?" of things by writing this article. Why do people keep publishing the same article over and over again with new year tag on it? Also why does Google index it? I am curious what happens if it is actually written by someone WHO KNOWS SOMETHING about programming.)