Your First Programming Language
What programming language should you learn first? Back in University, juniors who wanted to get on the programming roller coaster often asked me this. After much deliberation, I think I have my answer. In this post I express why I think a lot of conventional wisdom here isn’t the best, and what I suggest as the first language for getting started with coding.
“What programming language should I pick up first?”
One of the better known flame wars in the world of computer programming. And one with a diversity in answers that will surprise you if you reflect on it. Some feel that a dynamically typed interpreted language is how you should start, while others see value in being used to a type system and a compiler from the get go.
I humbly disagree with all these people.
Every single language has trade-offs. Many exist to make up for the shortcomings of the ones that preceded them. But in the (narrow) context of a complete beginner who wants to learn how to make a computer do their bidding, I think all these languages fall short.
Now that I’ve whined enough, I am compelled to offer an alternative opinion.
I think that the first language one should learn is Lisp. Any dialect is fine, though I suggest going for a modern one. I personally favour Clojure. Racket is another excellent option. If you want to go for Common Lisp, SBCL is a battle tested implementation. Here’s why (note that I often qualify sentences with words like “often” because there are multiple dialects of lisp, and some excel more than others in certain areas):
- Lisp is productive. Not just because it is often dynamically typed, but because it offers a REPL that you can spin up and play with just like you would with Python.
- Lisp is extendable. It puts you on the same pedestal as the language designers of Lisp. In other languages, when you want new functionality, you write a library that exports a bunch of functions or other interfaces. In lisp, you can literally build new syntax for lisp using lisp. These powers are conferred by the unparalled (in my experience at least) macro system. There is a reason why Lisp is called “the programmable programming language”. This is something you will miss in every other language you pick up.
- Lisp is flexible. You can adapt it to fit almost any pattern, paradigm or idiom. You can bend it to your will. Lisp empowers you.
- Lisp is intuitive. You’ll have to try it to see why. One of the reasons is that you essentially write the AST of the program when you code in Lisp.
- Lisp isn’t hard. This is probably opinionated, but I find that some languages are hard. C is hard. At my current level, I find Rust hard (an opinion shared by many). They say that “Erlang makes the easy things hard, the hard things easy”. Lisp may not be as easy (e.g. in terms of readability) as Python, but it is very accessible and something that a beginner can quickly pick up.
In addition to that bullet list, I strongly encourage you to read the introductory chapter of Practical Common Lisp to understand the pitch behind Lisp in a much better articulated way and by a far more experienced Lisper. The book is an excellent dive into Common Lisp if you’re picking that up.
As with any other thing of this sort, Lisp is not without drawbacks. And it would be remiss of me to leave you without some sense of what you might not like if you pick up Lisp.
- Lisp is not mainstream. This means that Lisper communities are much smaller than those of more mainstream languages. It also means that Lisp skills don’t directly translate to job requirements the way experience with (for example) Python or Java does. But note that there are a ton of companies that heavily use Lisp. Some fairly critical internal slackbots (and a quite a few non-critical ones) at Platform.sh are written in Common Lisp or Clojure.
- Lisp can be somewhat difficult to read. Especially to the untrained eye. Especially when looking at the code of experienced Lispers employing Master Mage level incantations. This is in contrast with languages like Python or Golang which have a reputation for readability.
But all things considered, I think Lisp is an excellent first language to dip your toes in the ocean of programming. And I wish you luck in that journey.