Which programming languages should I learn: Beginners Edition

by Matthew Adams

My post yesterday about programming language diversity and barriers to adoption prompted a fair bit of discussion, I’m pleased to say.

Some of the most frequent comments were about languages I had erased from history.

First, I forgot about the languages that are often overlooked unless you have a statistical or mathematical bent. MatLab and R.

The thing that most interested me, though, was that several people asked “why didn’t you mention Pascal/Delphi?” This led to a discussion about the need for a ‘learning’ language.

Once upon a time, we maybe started out with Logo to understand simple command sequencing, or BASIC – both, you’ll note, frequently provided with interpreters or REPL-type environments which are great to learn in.

For a while, PASCAL was a popular learning language on University courses – in fact, it was designed by Niklaus Wirth precisely to help educate people about the whacky ‘new’ ideas that we should organize our programs in structured blocks, with subroutines, and loops and things(1).

What should a learning language offer today?

1) A REPL environment

I think this is an absolute prerequisite. I want to be able to type something on the screen, and see the result. Immediately. No messing about with compiling and linking and nonsense.

2) Good library support for popular data structures & algorithms

There should be good implementations of most popular data structures and algorithms. And I should be able to read and understand the source for them.

3) A clean, cruft-free syntax

Ideally, we remove as many of the language warts as possible (like the unnecessary braces of the C-family). The language should be simple, and expressive.

It should be easy to go from something like

to

And see self-similarity as we build up the constructs we are using.

4) A good balance of support for OO representations and functional techniques

This is the key challenge for a modern learning language. In my view, it is likely to be a primarily functional language with classes, rather than the other way around.

5) At least one free (as in beer) implementation

Pity the poor student. There shouldn’t be a financial penalty for learning a language. I don’t care whether it is free as in OSS/GPL/MIT free, or free as in “a zero-cost license in perpetuity”. Your politics may vary.

6) A vibrant enthusiast community

There has to be an enthusiastic community around it. In part, this means it has to have some heritage, and a sense of future. People actively working on it in the academic sphere would be a good idea, too. And, ideally, some mainstream commercial use to avoid the accusation that it is just a toy language you are learning.

And the award for best language to learn goes to…

I’ve thought about this quite hard. I’ve considered Python, and Scala; Ruby, C# & JavaScript; Erlang, Haskell and FORTH(2).

And in the end, I’ve plumped for… F#.

It has great support for both functional techniques, and OO. There is OSS support across Windows, Mac and Linux, but it also has a commercially supported implementation – you can (and should!) use it for real world projects.

The tooling and debugging experience is very good (even in the OSS implementations), largely because it is built on top of the CLR, and it has superb support for fundamental data structures and algorithms.

And, most of important of all, it was born in the fair City in which I live. (Cambridge).

Follow @dsyme on Twitter and you’ll get all the F# love you need.

We’ve also started a Learning to Program series. We’d love your feedback, especially if you are a beginner.

Learning To Program – A Beginners Guide – Part One – Introduction
Learning To Program – A Beginners Guide – Part Two – Setting Up
Learning To Program – A Beginners Guide – Part Three – What is a computer?
Learning To Program – A Beginners Guide – Part Four – A simple model of a computer
Learning To Program – A Beginners Guide – Part Five – Running a program
Learning To Program – A Beginners Guide – Part Six – A First Look at Algorithms
Learning To Program – A Beginners Guide – Part Seven – Representing Numbers
Learning To Program – A Beginners Guide – Part Eight – Working With Logic

Footnotes

(1) One interesting ‘thing’ was a ‘set’ type that let you perform set operations.

(2) OK, maybe I didn’t really consider FORTH.

Matthew Adams on Twitter