tips-computer-programming-languagesToLearn

What languages should a person new or sort-of new to programming learn first?

(as of 2014)

I would recommend learning Python first. Then after you learn that, learn Haskell. Then after you learn those two, learn C.

In all of these cases, by "learn", I don't mean "spend two years becoming a proficient professional user of the language", but only "spend a little while until you know the basics, can hack on it enough to get simple projects done, even if in a non-idiomatic way, have written a few demos, and can read others' code, unless their code is advanced". After you know the basics of all of these three languages, you can go back and learn more of one of them if you like.

What next after those three?

I restricted myself to these three because these are the only three such that, if even an advanced programmer didn't know one of them, i would encourage them to immediately learn it. After these, you will know the basics and you may choose the next language you want to learn by what sounds interesting or useful to you.

If you'd like some ideas, other popular languages include Java, PHP, and Javascript. Other languages which are not very popular, but which are highly beloved by the people who know them, include Lua, Go, Racket, and Clojure (note: Racket and Clojure are both in the Lisp family). C# has the dual virtue of being moderately popular as well as moderately beloved.

To provide some color to that list: After C, Java is the most popular language; PHP is known for web applications and many famous web apps such as Wordpress are written in PHP; Java and PHP, although popular, are much hated; Javascript is simple and easy to learn and is the only language for client-side scripting on most contemporary web browsers; Lua is a very simple and easy to learn language that is said to be great for embedding; Go is said to be great for writing servers; Racket and Clojure are Lisps, which means among other things that they are relatively easy to learn and that they are "programmable programming languages"; Racket is said to be good for prototyping programming languages; Clojure runs on the JVM, which means that you can use Java libraries from Clojure programs; Clojure is oriented towards functional programming and has some support for lazy data structures; C# came after Java and in some ways is like a better Java.

If you really want a recommendation for language number 4, i would learn a Lisp, probably either Racket or Clojure, although with a focus on macros; so maybe i'd just read On Lisp.

Why do i choose these three?

I considered how much people who know the language love it, how i personally feel about the language, what concepts you learn by learning the language, how easy the language is to learn, and how popular the language is.

Python and C are the only languages which (according to my reckoning) combine extreme popularity with extreme belovedness.

Python is one of the few languages that is a very easy first language to learn (relative to other programming languages, that is; learning your first programming language is somewhat difficult in absolute terms). This is due to its focus on readability and cognitive economy, on learnability iteslf, as well as to its polish, its use of garbage collection, dynamic typing, good primitives for string manipulation, lists, and dictionaries, and the lack of a separate compilation step.

The combination of ease of learning, extreme popularity, and extreme belovedness form a strong argument for Python to be the first language to learn. Also, at this time Python is my personal favorite language.

One of the first three languages learned should cover low-level stuff. Either C or assembly are the best for that. And C is the only other language which it both extremely popular and extremely beloved. This presents a very strong argument for C to be in the first 3 languages that you learn.

So, for the first three languages, there is only one slot left. We want a language which is beloved and which, when combined with Python and C, leaves the learner with a wide variety of programming concepts.

Python will teach imperative, procedural, and object-oriented programming concepts (these are names for patterns of thought; you might not ever hear the words "imperative", "procedural", or "object-oriented programming" when actually learning Python, but you will have learned those thought patterns even if you don't learn the names for them). C will teach static typing, compilation, and lower-level concepts such as the linear layout of memory and memory addresses, the layout and representation of data structures in memory, pointers, and memory allocation.

For the third language, I chose Haskell because it teaches the lazy functional paradigm as well as various expressive static type system features such as parametric polymorphism. Haskell is not very popular but it is very beloved by the people who know it. I recommend learning Haskell second, in the middle of Python and C, rather than third, because Python and C are in some ways similar to each other and different from Haskell.

Haskell is probably a controversial recommendation for a second language for beginners, because this language is thought of as very hard. Imo that is just because it is so different from imperative languages that learning it is like starting over and learning to program all over again; but if you had learned Haskell first it would be only a little more difficult than learning another language first. So this isn't a reason not to learn it early (why do i say it is even a little more difficult to learn than others? Because Haskell is not as focused on readability, cognitive economy, and practicality as Python is; and also because Haskell's community is currently composed mainly of very smart computer science academics, who therefore tend to write documentation and to answer questions on the mailing list in a way that is hard for non-cs beginners to read; so when you search Google for answers to Haskell questions or for Haskell tutorials, most of the results won't make any sense).

Let's take stock of what has been learned. Python and C have taught imperative and procedural concepts. Python has taught object-oriented programming concepts. Haskell has taught the pure/functional programming paradigm, various expressive static type system features such as parametric polymorphism, and lazy evaluation. C has taught static typing and compilation, and lower-level concepts such as the linear layout of memory and memory addresses, the layout and representation of data structures in memory, pointers, and memory allocation.

Why not learn language X before one or more of those?

Above, i presented a strong argument for both Python and C being among the first 3 languages learned (they are the only languages which are both extremely beloved and extremely popular, one of them is very easy to learn, and one of them teaches low-level concepts). If you buy that argument, then there is only one open slot. I chose Haskell because I thought the lazy functional paradigm is both important and mind-expanding, and because it teaches various static type system features.

In terms of language families, Lisps are notably absent from my list. Lisps are easy languages to learn and they teach macros. But in my opinion, the lazy functional paradigm is more important to learn early than the macro paradigm, and although you CAN learn lazy functional programming concepts with various Lisps, it's easier to learn them in Haskell because Haskell is so extreme. I do however mention Lisps in my "what next after those three?" section, so learners intrigued by the notion of a "programmable programming language" might learn them afterwards.

Besides macros, some other concepts that are missing from my list are concurrency and logic programming.

Someday i dream of creating a programming language which, like Python, focuses on readability and cognitive economy, and has garbage collection and good primitives for string manipulation, lists, and dictionaries, but unlike Python, supports a lazy functional style, macros, optional static typing, and massive concurrency (yes, i realize that existing languages such as Racket and Clojure fill most of those criteria, but i also have some other ideas in mind beyond what i am writing here).