back

by surprisetalk·8y ago·view on hn ↗
I like to think of each programming language as a separate musical instrument.

If Java is a tuba, then maybe Python is a trumpet. They're two very different instruments, but they share a lot of the same underlying intuitions. In fact, I would say that C-style languages are probably equivalent to the collection of brass instruments. There are major variations from trombones to trumpets to french-horns, but not as large as you'd think.

So if you've only played tuba, what happens when somebody hands you a violin? You may understand "music theory" (or computer science) pretty well, but actually sitting down to learn the violin will give you strange insights that aren't apparent on brass instruments. For instance, violins' strings are tuned perfect-fifths apart -- certain scale patterns naturally jump out at you. In the same way, let's compare Haskell/Idris/R to stringed-instruments. It's easy to switch between them when you realize that a viola is a cello is an upside-down bass-guitar. And at a higher level, learning violin and tuba together will make you better at BOTH instruments! As a bonus, playing music is more fun when you can antipate the habits and difficulties of your peers' instruments.

As a side-note, I think Lisp is either a piano or a theremin. I'm not sure why.

Anyway, I think learning each "family" of languages is a worthy aim for every engineer. Here are the groups that I personally hope to master over my lifetime:

  - Hard         : Assembly
  - C-Like       : C, Java, Python, JS, PHP, etc.
  - Pure Fun     : Haskell, Idris, OCaml, Elm, etc.
  - Distributed  : Erlang, Elixir
  - OO           : Smalltalk
  - Lispy        : Scheme, CL, Clojure
  - Stringy      : BASH, Perl, SNOBOL
  - Code-Golfy   : APL, J, K, AntLang
  - Stacky       : Forth, Joy
  - Data-Driven  : R, Mathematica, Wolfram Language
  - Logic-Driven : Prolog
This list is long, but don't let it discourage you! Every family has plenty of magical ideas that make the next one easier to master.

Best of luck on your journey!

2 comments
Perl fits into C-Like, Pure Fun and Code-Golfy in addition to Stringy.
In general languages tend to focus on one thing, where Perl tend to focus on many things. So it is difficult to classify.

In addition almost everything that is easy in Perl 5 is also easy in Perl 6, but it also makes a wide variety of additional things easy. For example there is are several meta operators for dealing with lists.

  (1,2,3) Z+ (10,20,30); # (11, 22, 33)
  [Z+] ( (1,2,3), (10,20,30), (100,200,300) ); # (111, 222, 333)

  [Z*] (1,2,3,4,5), ( 10 xx Inf ), ( i xx Inf ); # (0+10i, 0+20i, 0+30i, 0+40i, 0+50i)

  ((1,1),(2,2),(3,3)) «+» ((40,50,60),)
  # ((41, 51, 61), (42, 52, 62), (43, 53, 63))
So it has a lot in common with data-driven languages.

There are also features which you might expect to see in a distributed language.

Basically if there is a choice between A and B, Perl tends to choose both. With Perl 6 doing this to a greater extent than previous Perls.

I would add tcl to the stringy list.