Which programming language should you learn?
Tags: programming, learning, programminglanguage, languagelearning
Published: 2017-12-06 20:37:07

---
title: "Which programming language should you learn?"
published: true
tags: programming,learning,programming-language,language-learning
canonical_url: 
---

This question turns out now and then on forums, Facebook, and so on. Since I got tired of writing always the same things, I decided to write my suggestions here once for&nbsp;all.

As usually, with this kind of questions, everything depends on your starting point (are you a beginner? an amateur?) and your target (do you want to do web development? Contribute to open source projects? Program small devices like STM32?). Usually who asks this question is a beginner and does not say anything about specific goals, therefore usually I assume that the objective is to get some “culture” in this field. The answer that follows is written with this generic objective in&nbsp;mind.

### Step 1&nbsp;: learn to program (simplicity is the&nbsp;key)

If you have no experience in programming at all, I will suggest starting with something simple, in order to learn _how to program_ before actually _learning a language_.

Yes, because “learning to program” is not the same of “learning a programming language.” Learning to program means learning how to decompose a problem into smaller problems and specify a procedure to solve them. Knowing how to do this is a skill that is independent on the specific language and somehow on a higher level than knowing programming languages. You can write programs without even having a PC, but just pen and&nbsp;paper.

> [Ada Lovelace](https://en.wikipedia.org/wiki/Ada_Lovelace), daughter of Lord Byron (yes, **that** Byron!), is considered the first programmer in history because of her notes to the [article](http://www.fourmilab.ch/babbage/sketch.html) on the [Analytical Engine](https://en.wikipedia.org/wiki/Analytical_Engine) designed (but never built) by [Charles Babbage,](https://en.wikipedia.org/wiki/Charles_Babbage) a kind of computer of ‘800, but with the register made with gears and powered with steam… (I would suggest reading the [Ada Lovelace article](http://www.fourmilab.ch/babbage/sketch.html), it is very interesting)

Of course, even for learning the skill of programming a language is necessary, but I would stay on something simple.

A language that was suited for beginners, in my opinion, was BASIC. It was fairly popular in the ’80 when every home computer had some kind of BASIC interpreter built-in. Although simple, it had all the necessary features and one could write quite complex stuff with it, although the resulting code was not very maintainable. An advantage of BASIC was that it was interpreted: you could write a single command and having it executed immediately, without the need of an&nbsp;IDE.

Since BASIC is much less popular nowadays, I think that C is another good choice as a starting point since it is fairly simple. C is also quite low-level, giving you visibility of some machine level stuff like pointers and stack and this is useful because it gives you a sensibility about what happens “under the hood” even with other languages. (I find that this kind intuition helps me a lot when I learn a new language). Be sure to learn even all the tiny, obscure details of C such as pointers, struct, unions, functions with variable argument list (such as&nbsp;printf).

Also with C you will learn about macro expansion, a methodology used in several places and that requires a mindset slightly different from the one used in imperative languages like C. To be honest, I do not love macro expansion since it is quite error-prone and it can make the code less readable, but there are context where it is&nbsp;useful.

### Second step: best practices & OOP with&nbsp;Ada

Since object-oriented programming (OOP) is widely diffused and fashionable, as a second language many would suggest C++ or Java. However, I am going to be heretic and suggest [Ada](https://en.wikipedia.org/wiki/Ada_(programming_language)). Beyond allowing OOP, it is a modern language, very powerful with strong emphasis on correctness and maintainability. It can introduce you also to stuff that it is not common in other languages such as contracts, type invariants and formal checking. Studying it you will learn some “good practices” in programming that will be useful even with other languages.

> Since Ada is not widely used, finding information in the network is not easy. Few useful links: you can get an open-source, gcc-based compiler here: [http://libre.adacore.com/](http://l.facebook.com/l.php?u=http%3A%2F%2Flibre.adacore.com%2F&h=zAQFgNuwR). For an introduction to the language see the [Adacore University](http://u.adacore.com/), for an easy reference see the [Wikibook](https://en.wikibooks.org/wiki/Ada_Programming), for a mix of resources see the [Ada Information Clearinghouse](http://www.adaic.org/) (where you can find the reference manual) and the site of [Adacore](https://www.adacore.com/). Finally, you can meet other Ada-ists on the usenet group comp.lang.ada and on some LinkedIn&nbsp;groups.

#### Now you have the most important basics

Once you have a good experience of C and Ada, learning other languages is just a matter of learning a new syntax and maybe one or two new concepts. I, for example, learned Ruby in few hours just using a tutorial. In the end, most of the current languages are very similar one&nbsp;another.

### Polishing it&nbsp;: Ruby/Python and&nbsp;assembly

Finally, to round everything up, I would suggest, as the cake icing, a scripting language like Ruby or Python and maybe some assembly. It is true that assembly is not used much nowadays (although it depends on your context), but some experience of assembly will give you some good understanding of what happens “under the&nbsp;hood.”  Moreover, it is so much fun to go so close to the processor that you can almost feel the silicon... :-)

### Strange stuff: functional languages, PROLOG,&nbsp;….

If you really want the widest view, you can also try some fancy stuff like functional languages (Eiffel, Haskell,&nbsp;… even LISP) and logic programming stuff like PROLOG. Those languages have a “model” that is different from the usual “procedural” model. I did not see them used too much and I wonder if they are suited for very large scale and very long lived software, but it is useful to know that they exist and how they&nbsp;work.

### Conclusions and final&nbsp;remarks

I hope that you found this useful or that, at least, gave you some ideas about programming. A final suggestion: my experience is that the best way to learn a new language is to use it. After you got acquainted with the syntax, choose a project of intermediate difficulty (even a silly one, it does not necessarily need to be useful) and do it (and, possibly, have&nbsp;fun…)