06 August 2011

Really different programming languages

If you have the luxury of time to learn a new programming language, here's my plug to learn a really different one. Though there is value in seeing a slightly different take on the same idea, like listening to a cover of a song, life is too short to spend time on that before you've exposed yourself to something really different.

Make sure you know what "really different" means, too. The popular discourse surrounding programming languages centers on what are really tiny differences. So you can easily get a false sense of what "really different" means. There's some truth to the idea that the brilliant success of our consumer culture is to make us think we have choice while in fact providing us with very little. That having been said, a language doesn't have to be unpopular to be really different, and of course not all unpopular languages are really different.

Some of the really different languages I've been exposed to were popular, but, importantly, not with people who consider themselves programmers. For instance, in my experience, languages used for musical applications tend to be really different. Perhaps I'll make another blog post to explore why this might be more than coincidental. But regardless, domain-specific languages are a good place to look for real difference.

I'll name a few, but these are just examples: my point here is not to promote specific languages. For music, Max. For signal processing and controls, Simulink and Stateflow.

Back to the category of good old general purpose languages for programmers, I'll give as examples Haskell, Prolog, and Erlang.

What is so important to me about Haskell is its purity. That is, its lack of implicit side-effects. Any functional language will open your eyes somewhat, and any language with type inference will do the same, but Haskell is the only one I know of that is pure. Laziness might be pretty hard to come by outside of Haskell, too. But to reiterate, because I want to be very clear on this point, I am not recommending Haskell. I am recommending being exposed to the big, really different ideas that Haskell represents.

Prolog and Erlang I myself have never tried, but they seem to represent big, really different ideas about programming, so I really want to try them, and I really want you to try them.

In closing, if you already know C++, try not to learn Java or C#. If you already know Ruby, try not to learn Python or Perl. In fact, if you know any of the languages I just mentioned, try not to learn any other of them. They're all object-oriented, imperative, textual languages. True, some are dynamically typed and some are statically typed. And true, the statically typed among them have different approaches to generic programming. And true, some have garbage collection and some do not. And C# has LINQ, which is interesting, and it has the capability to do things like LINQ, which is perhaps even more interesting.

Well now in my closing I've almost convinced myself out of my own argument. I guess I'll soften my argument to this, then: try to learn a really different language, but if you can't, when you learn a not-so-different language, focus on those features that are really different. As an extreme counter-example, I once saw a list of distinctive features of C# and it included easy quoting of strings with backslashes in them to make Windows paths feel more idiomatic. While I acknowledge that this may be of some pragmatic value, this is not the kind of thing that causes your mind to expand by learning C#.

Sorry to end on that negative note.

No comments:

Post a Comment