When it comes to a becoming a better programmer you often hear the idea that you should learn the programming language X. Where X might be Haskell, Lisp, Rust, C (yes for low level thinking), Prolog or another one from a very long list. It is a very old statement that wouldn't be out of place in a usenet posting from 1988.
The statement while not untrue is, like many statements on the internet, actually quite nuanced. First, let me take you back to 1990. I had a smattering of programming in Basic and not a lot else, so I am not going to be taking part in this story. Instead lets think about C and Lisp. They both existed at the time as mature programming languages.
C was, and still is, a low level language where the most abstract language feature is the switch statement. The compiler has the option of using a jump table, multiple jump tables or even multiple compare (if) statements to create a binary search, everything else in C had a pretty obvious mapping to assembly language. Programmers using C thought with functions and structures.
Lisp was also very mature at this point containing higher order functions, proper macros, garbage collection, an interactive repl and many other features that don't have obvious mapping to assembly language. Lisp programmers thought with many more words in their language lexicon.
It is fair to say these languages were/are worlds apart. A C programmer would be in for a brain bending experience learning Lisp as it introduced many of it core building blocks. The idea of closures as first class citizens and using it as a way to safely built abstractions would have been difficult to grasp and the macro system would have blown them away. I almost envy a C programmer in 1990 getting hold of the SCIP book.
The reverse is also partially true. A Lisp programmer moving to C would suddenly have been able to talk directly to the hardware and there was some pretty cool hardware around at the time.
In this instance our original statement would be true for a C programmer learning Lisp and vice versa.
And Back to 2021
Fast forward to today and the landscape has changed. Low level languages like C++ and Rust have introduced many of the feature traditionally found in Lisp or Haskell. Sure not everything but enough to close the gap that you could start to question the benefit of learning a new language is the best way to grow/improve.
I don't have data to back it up but my impression is if we plotted the features of popular programming languages on a Venn diagram there would be significant overlap and this overlap seems to be increasing with time. The are different trade offs in each language so they are still interesting at some level but learning a new, mainstream, language just is not going to be exciting as doing so in 1990. Sorry.
This is not to say learning a new programming will not shift your views, just careful selection is required to maximise this benefit.
I should at this point there are some good reasons for learning a language similar to the one(s) you already know.
- Financial. Perhaps you are changing fields or your field is trending towards another language. Objective C to Swift would be a good example and perhaps in a few years C++ to Rust will be another, early signs look good. There have been a number of times where it looks like things were trending one way but it didn't work out but that is for a different post. If putting food on the table could be affected by a trend I would say make sure you are ready for the change. If you are a C++ programmer take a look at Rust.
- You really like programming languages at a design level. The trade offs are fascinating to you and the more you see different variants the more you understand. Welcome to neighbourhood I like to hang out in even if I don't make an attempt to be rigorous in this area.
- The programming language targets the niche better. A C developer learning Java or Kotlin as they want to write an Android app with so much pain.
Getting more Bang for your Buck.
If you know any programming language then learning another one may bring in new ideas. In general though you want to pick a language that is distant to yours if your goal is 100% improve the mind through this process. The means picking something quite outside of the mainstream languages.
Well designed non mainstream languages provide at least one of the following:
- Features to be found in future mainstream languages.
- A glimpse of ideas from the past.
- Just how differently some peoples minds can work!
I guess badly designed programming language rehash already existing common ideas in an unexciting way.
To me these languages fit into the well designed category (Not a complete list)
- Raku (AKA Perl 6)
I don't claim to know any of these very well but these all seem to contain interesting ideas, that I would love to spend 3 months exploring if time allowed. I will let you figure out which hint at a future, look to the past or fall into that third category. Often it is not just the language here but the whole approach to the tooling around it.
What should I learn instead?
Well learn something else. That is not helpful, I know.
What I mean is programming is not really about programming languages or the latest libraries. Over the long run is is about concepts, ideas and the machine that you use to apply them.
I know, that is not really useful either. So lets ask some questions to get the trades offs more explicit. Is it better to learn a new programming language or:
- Write and interpreter for a language you created.
- Better understand hardware. Caches, memory and assembly instructions.
- Understand the theory about surrounding topics.
- Investigate new area in computing, AI, databases, networking...
- Math, well any part really.
All these could bring benefits to the way you think. Some probably have better pay off then others but more importantly pick something that interests you. Much of my recent learning has really come from a question starting with "I wonder ..."
My most recent question I asked myself w as "I wonder if Haskell really offers much over Rust?" This led me to start to explore Haskell and prompted this post.
That Venn diagram you mentioned?
You might expect language diversity to be as broad as the application of programming but to reach mainstream status or dominate in a particular field you can't deviate to far from the average. I have a few ideas on why this might be.
One solution to this is we are slowly converging on a set to ideas/tooling that work best for programming in all fields. While a nice goal, I am personally not yet convinced this is happening. There is a lack of scientific studies to back this idea up. Yes it is hard to do these studies and I doubt think there is much grant money for it. Without data we are left without a rigorous way to quantify this.
Just because we are not measuring it doesn't mean it is not happening would be a good counter reply to this. There are pointers
- Software does not seem to be getting that much better, in some cases it is going backwards. You need to be old (ish) to appreciate this.
- Outliers exist, Both individuals and companies and often they avoid whole sections of language ideas. A topic for another post if I can get my thoughts clear enough.
Another idea postulated is for a programming language to become mainstream it must target corporate markets for which a certain set of features is popular. It doesn't matter if popular stems from that set actually working in the domain or people subscribing to group think. What matters is the jobs pay well and the language can fit into the corporate culture of large groups working where individual programmer productivity does not factor into the calculation. At a certain level of budget programmers become cheap and if something is cheap you scale them out as much as possible. The idea of scaling out programmers feels unsettling or inhumane in a way I can't quite put my finger on.
The third possibility is libraries not the programming language are what make a programming language usable in a domain. If this is true the trend of less diversely designed languages will continue so idioms from a successful library can be copied easily to different languages.
Finally I should offer the idea programmers as a group are lazy. They don't want to learn anything too different. So pick something close to what they know. While most programmers I know don't seem to be like this as a large group we could be?
To bring this back onto the topic. Very often learning a new programming language will not bring enlightenment as most languages you try are just too similar. So if you seek light bulb moments your probability of achieving this increases by picking a programming language that will not get a job. There are many other topics outside of languages to investigate so I guess my advice is do what pulls you in the most, be curious and don't shy away from the hard things.
- Maybe I am just not familiar with enough modern programming languages others may invalidate my Venn diagram hypothesis. The post relies on that a fair bit. Although the 1990 argument stands without it.
- I deliberately picked (Common) Lisp and C for the 1990 comparison as neither language has evolved too much from their 1990s state so looking at them today gives you a flavour of what they were like in the 90s. Other languages around in the 90s that as still around today have evolved significantly.