Stretch your programming skills: 4 languages you should learn this year
One of my LinkedIn contacts shares a lot of web posts, and soon after the beginning of the year he shared “10 programming languages you should learn in 2014” from Mashable.com. The list in this post is dominated by languages with C-derived syntax (including C, which is about as C-derived as you can get), and five languages that are some variant of object-oriented. There is a lot of shared knowledge there, and learning both C# and Java is kind of a waste of time.
So as a professional, what should you learn? First, why are you learning a new language (or technology stack)? If it is to get a job, don’t look at lists like this; pick the language that matches the work that you want to do. This is why Code Fellows courses, bootcamps, and accelerators are focused on a technology stack.
But what if you are a professional programmer and want to get better at programming? What can you learn that will improve your programming? I want to suggest some classes of languages that will help you develop your skills in how you approach different problems, even if you are using a different language.
This is not about building knowledge of subtle differences, like memory allocation/deallocation in C versus C++. It's about building up your understanding of programming.
As much as I hate blogs with these "N things you should" topics, here's are my 4 suggestions.
1. An assembly language
Ultimately your code is running on a CPU, and having a basic appreciation of how programs work on the hardware is useful in understanding the high-level magic you get to do with scripting languages.
You don't have to go deep here. Write a simple program with a single function/procedure, play with parameter passing and addressing modes—learn what an activation record actually is so that when your recursive function dies a gruesome death you know what is going on.
Most of us have computers with some variant of an x86 processor, but since you aren't trying to become an assembly language jockey, you might consider an emulator. My suggestion is the PDP 11. For a helpful resource, this course has some materials and has about the right scope.
The PDP 11 was a computer big enough to need a decent sized truck to move, but has all the architecture to teach you what you need to know. Instructions here look like
ADD (R2)+, R0
which requires some details to understand. You should keep in mind that this could be a rabbit hole, so make sure you learn just enough.
Get in, get out—and don't waste your time!
2. A (typed) functional language
A program in a functional language is basically just an expression that is evaluated to execute the program. So, this
is a program. Variables are like in math—we say "let x be 5" in some computation, and
the value 5 throughout the computation.
In Standard ML (Meta-Language), we can write
let val x = 5 in x*2 end;
to bind the value 5 to
x in the evaluation of
We can rebind the value, but this won't affect the definition of functions that
use the earlier binding.
I would suggest learning a language in the ML family, but any will do. I am partial to Standard ML (and the SML of NJ implementation), but there is also OCaml and Scala, which both have more industry presence (and object-oriented features—more on that later).
One of the key ideas in these languages is that of type inference—you don't always have to specify the types of things, yet the type rules are checked and strongly enforced.
For instance, if I define the function
fun f x y = x*y;
in the command-line interpreter, the system will respond with
val f = fn : int -> int -> int
telling me that
f is bound to a function that takes two integers and gives back
In this case, it used rules about the types in multiplication, but in other cases it will use information about types to infer the type of an expression (when it is not ambigous).
Types can also be polymorphic, but that is something you should learn about on your own.
Unlike with assembly language, you need to dive in to a functional language to gain some advantage. Pick something relatively hefty to build that requires you to think and ensures that you are using the language to its fullest extent. You want to work over complex recursively defined types with pattern matching, and also use modules and signatures. Build something that would push you regardless; perhaps involving a B-tree, suffix tree or trie. Or, if you are feeling really adventurous, try following Appel's Modern Compiler Implementation in ML at least until you feel comfortable traversing abstract syntax trees. You'll want to understand how we move information around as we traverse complex structures.
3. An object-oriented language
One suggestion is the language Eiffel (with resources here). It's creator, Bertrand Meyer, has a lot of interesting ideas about software development and the role that a language plays, and Eiffel was carefully designed for these purposes. It is definitely worth a look as an alternative source of good ideas.
Ultimately, you might want to try to roll your functional and OO experience together into what the Scala world calls object-functional programming. Scala is the obvious place to start for this, but OCaml also provides the opportunity (I recommend the Real World OCaml book).
4. A logic programming language
In a logic program, we have our data, which is stated as facts of the form
along with rules of the form
eats(X,Z) :- eats(X,Y),eats(Y,Z).
which states transitive closure on the
eats relation, and allows the conclusion
that "if ben eats grubs, and grubs eat salad, then ben eats salad."
Therefore, the response to the query
yes or true.
With this program we can also ask things like
"what eats salad?" as
and "what does ben eat?" as
The language provides us with a lot of flexibility in exploring the data set.
At its base, the languages are simple, but the implementations allow for more complex computations.
Start with Prolog using the SWI-Prolog implementation and work through the tutorials. Your goal is to get familiar with the recursion and understand how the structure of your data and rules affect the computation.
There are a lot of parallels with functional programming, but the ability to use bindings in different ways really changes things up.
So give it a go. Learning a new language in each of these classes will not only stretch your abilities as a professional programmer, it will also develop your understanding of computation and hone your understanding of the craft of programming.