Language Dabbling Considered Wasteful

[Update: I have renamed this post. The original name, "New Languages Considered Harmful", was supposed to be a tongue-in-cheek way to get people thinking. I chose it playing off of the reference to Dijkstra later in the post. It's absurd when taken literally: every language was once "new", and what exactly should we stick with? ALGOL? Fortran? Analytical engine punch cards? Unfortunately it came across as incendiary, which was not my intention. This post is not about computer science education: I believe it's important for programmers to be exposed to a variety of languages and paradigms as part of their education. It is about how much professionals get from learning new languages. There are enormous productivity gains one gets from sticking with a small set of orthogonal languages; moreover, dabbling in languages is overrated as a way to get better at programming (in particular, when compared to reading high-quality source code). Plus there's a world of stuff to learn, some of which I think has better returns than a new language for most programmers. Examples of these "language sets" could be C/Ruby/LISP, C#/F#/JavaScript, C++/Python/Java, etc. The sets are not static, but in my experience there's seldom good reason for change. In my own personal set I've had two changes in the last 7 years: Ruby displaced Perl and JavaScript got added. The original article is below in all of its flame-inducing glory.]

Learning new programming languages is often a waste of time for professional programmers. It may be a fun waste of time (i.e., a hobby), but it’s a waste nonetheless. If you do it for pleasure, then great, but profit is scarce. Pointing this out among good programmers is heresy: even the pragmatic programmers, whose teachings are by and large excellent, suggest we should learn one new programming language every year. That’s rubbish.

The theory is that by learning a new language you "expand your mind" and become "a better programmer". Right. By that kind of argument we should all be eating LSD (don’t). In reality learning a new language is a gritty business in which most of the effort is spent on low-value tasks with poor return on time invested. You need to get to know the libraries, struggle with the environment, find or tune a text editor, look for tools, and so on. Most of the effort has to do with housekeeping chores, which are surely not mind-expanding by anyone’s measure. If you hope to be productive in the new language, things are even bleaker: proficiency has less to do with the language itself than with the myriad technologies you must master to use it effectively.

Even core language learning offers dubious return. How much does it really help to learn a new syntax? How does it expand your mind to learn new operator precedence quirks? Much of what constitutes a language is lexical and syntactical bureaucracy. Worse, you’re learning absolutely nothing about fundamental aspects of computer science. No algorithms, no operating systems, no compiler theory, no math, no AI. If you’re an undergrad, then you should have time to pick up languages on the side while learning all that, of course. But a professional is making a trade-off: what else could you learn with that time? We’re better off studying business, security, usability, architecture, software estimation, and so on, rather than spending time with a different language every year.

If your goal is better programming, you will learn far more from reading high-quality code bases in your current languages than from a new language. Go read top-notch code in the languages you know already; it’ll teach you techniques and style quickly, plus different ways of thinking about problems, with the added bonus that you can actually use what you learn. You can also understand a lot about programming languages in general (issues like typing, scoping, functional vs. imperative) by reading a good book.

There’s another pernicious effect to language hopping: it hurts your momentum. Every time you rely on your current languages you get a little better. Not in a fluffy expand-your-mind way, but in a concrete way. You learn more about your libraries, you set up a new macro in the editor, you have a chance to use that new language feature. Scott Hanselman argues that learning a new language is sharpening your saw, but I see it as neglecting your half-sharpened saw while playing with the dull, new, shiny one. The upfront cost is not the only one either. It’s better to have 3 razor-sharp saws than 8 so-so ones. Each new language you add to your toolbox is making it harder for you to become furiously productive in any given language.

Clipper manual
Forget Ruby - Here’s Clipper!

Yet, any programmer worth their weight in silicon must know multiple languages. Sometimes the new saw is of a different type altogether, and it’s worth having. Right off the bat there are major obvious reasons. Different systems or parts of a system call for different languages; that’s been true in any environment I’ve ever worked in. For a while this was mostly due to speed and level of control. My first apps were written for MS-DOS in Clipper, which was a database-oriented rapid development language. Fast to develop, but no power. Soon enough we wanted to add features that called for C and assembly. Using C we could write terminate and stay resident (TSR) programs and spice up our apps with features no one else had. Sometimes the issue was not so much power, but speed. There have been many happy marriages to deal with this: Tcl and C, VB and C++, Perl and C, you name it. Fast processors and web apps have largely killed the speed/power motive. Computers can happily run applications written wholly in Python or Ruby. And if they can’t, a different language probably won’t help; you just need more web servers. But alas, you now need to know SQL and JavaScript too, so we’re back to obvious reasons for multiple languages.

Aside from the immediate reasons, there’s some merit to the mind expansion argument. I think being proficient in at least two languages is indeed important for boosting your ability as a developer. This resembles human language: learning a second one changes the way you think and your perception of the world. The third or fourth, not as much. But it can’t be any two languages. If you know Portuguese and Spanish, your mind didn’t have to expand much. Likewise, learning VB.net and C# doesn’t count. Also, I agree that some programming languages are hazardous to your skills if used exclusively. Edsger Dijkstra claimed COBOL crippled the mind and that its teaching should be regarded as criminal offense. We all know who’s the new COBOL. Java, the kingdom of nouns, is a programming straight jacket. I imagine Dijkstra would have called for harsh no-parole sentences for any CS Department chairs whose students learn only Java. If you write a lot of Java code, being fluent in a richer language does sharpen your saw. This is true for other statically typed languages, but to varying degrees. More on that in a bit.

Java protects developer from self
Java protects developer from self

You might think this is contradictory. You’d be right. Life’s not simple; sorry, I wish it were. The realities are:

But there’s a sane way to deal with these. Why, you just need to find the minimal language set. The smallest set of languages it takes to crank out great software quickly while growing as a programmer and making rivers of cash. In the next entry I’ll talk about my personal language set and the factors I used to compose it.

Comments

26 Responses to “Language Dabbling Considered Wasteful”

  1. Chris Chandler on April 3rd, 2008 5:15 pm

    Hey I used to do clipper, there is a reason I learned something new. Its not about learning curve its about productivity savings with new more terse ways of doing things. Meta programming is the newest set of constructs saving me hours a day. Bottom line, evolve or become extinct, learn or keep your ancient unproductive mess of a language set, choose wisely.

  2. Logan Buesching on April 3rd, 2008 5:43 pm

    I’d have to agree that while a new language every year may be a bit much. While you touch on the fact that learning similar languages as your two "core" languages is not diverse enough, I would argue that your entire argument is based on the fact that a person is learning a similar language to one they already know. I would have to disagree with your argument that [quote]"Much of what constitutes a language is lexical and syntactical bureaucracy."[/quote] If the language that you are learning only gives you insights into pretty new syntax, then I agree that it is a waste of time. The language that you choose to learn should give you some additional insight into computer science. I believe that everyone should be exposed to languages of every type such as compiled, object oriented, functional, scripting, procedural, declarative, etc. When you learn a new language, it should allow you to think differently. Every language is usually really good for specific purposes, and that is what you’re trying to learn when going to a new language, not just syntax and operator precedence. In fact, people believe that programming languages are such an important topic, there is an entire subject on it in computer science research.

  3. Cyndy Aleo-Carreira on April 3rd, 2008 7:51 pm

    Heresy! How will Silicon Valley OPERATE if people aren’t jumping to the next new thing constantly? Seriously, this is one of two posts on how programmers SHOULD work that I’ve seen this week that rock and ought to be entered into the Bible for young kids starting out.

  4. Andy Norris on April 3rd, 2008 8:05 pm

    Interesting argument. I thought you were just wrong until you got to the end and started talking about minimal language sets and complementary languages. That I kind of agree with. As a .Net programmer, my language set is currently C#, F#, and IronPython. Most of my code base is still in C#, but both F# and FePy add significant new capabilities that C# lacks. Long-term, I’m not convinced that C# is a big value add over just using F# and FePy. I also do JavaScript when I do websites, but there’s not a lot of choice there. I do think there’s value in tinkering with languages outside your core language set, but I tend to think that it’s not necessary to become fully fluent in them, but to study them just enough to harvest the interesting parts. For example, I never really understood C# delegates (though I used them just fine for events) until I studied higher order functions in Lisp, a language in which they’re a common idiom. (Obviously, other languages could have taught me this as well, but Lisp is the one I happened to tackle.) Lisp also taught me how much I wanted macros, so now I’m working on a new templating system to reduce boilerplate. Also, I’ve learned some interesting ideas about dynamic languages by learning a smattering of Ruby and Io. Not all of them are applicable to Python or JavaScript, but they nevertheless give me a clear idea of what I want to find a way to do. And, honestly, I didn’t know that F# would be a language that I needed to really use until I learned it. So I would say that it can be useful to learn new languages, as long as you’re focused on the takeaway and you don’t let your existing languages get rusty.

  5. Miles on April 3rd, 2008 8:56 pm

    This is just the old Tool maven vs. Language maven argument. http://urltea.com/32d1 Sounds like you’re into the Tools.

  6. Elias Amaral on April 4th, 2008 10:54 am

    i personally think that any professional programmer should know a functional language (like haskell or sml) and a imperative one (like c or java). the differences between haskell and c are so big that grasping the concepts of both just makes you better prepared to solve actual problems; there are some problems that just aren’t easly solved in any imperative language. you seems to know only imperative languages, so i understand why you think that learning a new language do not expand the imagination of a programmer. that is, if i know c and java, i do not understand anything really new learning, say, visual basic. (bom, vendo agora que vc é brasileiro, eu acho que eu deveria ter escrito a resposta em portugues. eu nao domino muito ingles e portanto nao consigo estruturar bem argumentos.. bah :P)

  7. Ferruccio on April 5th, 2008 6:08 am

    I think it all depends on what you mean by a "new" language. If you’re a C++ programmer, learning Java or C# really wont add much to your skill set except the ability to manipulate syntax. However, learning a truly different language can also change how you look at a problem. It can give you insights that you would never have had before. Let me give you (an admittedly dated) example. Suppose you’re a BASIC programmer (not VB, the old-school interpreted BASIC) and you need to code up an algorithm that has a simple recursive solution. Most likely you wont because the language simply does not support that idiom. You could do it with a bit of work, but you probably wont because if you’ve never been exposed to a language where recursion was natural and easy to express, it will probably never occur to you to use it.

  8. miguel rodriguez on April 5th, 2008 12:17 pm

    instead of just learning every language in vogue, you should be able to learn paradigms(and of course a paradigm needs a language), so you must know a statically language, a dynamic language, a OO language, a scripting language, a functional language, a procedural language, etc… for example I use C/C++(procedural, OO, statically), python(OO, dynamic, scripting), erlang(functional, dynamic, concurrent) so I try to covers most ideas instead of languages

  9. Gustavo Duarte on April 25th, 2008 12:40 am

    Hi folks,

    First off thank you for the thoughtful and well-reasoned comments. Lord knows this is a flame-prone subject, and it’s really cool all of the comments here were so sensible. Also, I failed to draw certain distinctions in the post, chiefly between computer science education and professional programming. I _completely_ agree that being exposed to different programming paradigms is important when one is learning computer science.

    But I also think that there are different tradeoffs when we’re actively building software. One point that several of you pointed out concerns functional languages. I come from a math background and have done a fair bit of functional programming. However, I do not currently use functional languages in my work and I don’t think I’d be getting more value out of them than out of my current languages.

    For the record, the languages that I use _actively_ (ie, substantial LOC per quarter) are Ruby, C#, JavaScript, and SQL. My main language is C#. I have written reams of C code, most of it kernel mode stuff or network daemon stuff, but currently none of that. Tons of Perl. A good lot of Object Pascal as well. I’ve done a lot of Lisp, C++, Mathematica, and Matlab. Currently almost none of that.

    I still consider Lisp and C as part of my “set”, such that any time I need systems code or FP, those are the languages I’ll use. I think Mathematica is beautiful, but my work has little relation to math anymore.

    @Chris: Amen.

    @Logan: I agree to some extent, but I think the orthogonal set of languages one needs to cover all the interesting ground is rather small. I see a few dimensions: functional, statically typed, dynamically typed, and close to the metal. I think some of the categories you point out, like compiled/oo/script, sort of collapse together, meaning a couple of languages might knock out several of them. Suppose one knows C, Lisp, Ruby, Java. What fundamental CS stayed out and cannot be brought in via macros, meta programming, etc? Regarding the research, yes, it’s important to be sure. The technology develops, new challenges develop, and so on. We now have the web, multi-cores, security, and obscene fast computers. Surely some language will arise to deal with these things. Also, of course progress comes from new languages, I’m for one am very grateful for Python/Ruby and other first class languages selected by the wonderful filter of the Internet.

    @Cyndy: hahaha :) This “throw everything out and start anew” thing is a disease. Radical change is way overrated over gradual improvement. Just like throwing away code bases and starting from scratch.

    @Andy: great stuff. Made me want to learn F# actually hahah :P I do feel the pain in C# sometimes due to the lack of macros and also mixins. I’ve thought about doing something crazy, like using partial classes generated in the background to hack some features on top of the language.

    Like I said above though, I’m a math head and am naturally fond of Lisp and friends, but I do not miss them at all in my current Ruby/C#/JavaScript world. What do you get out of F# that Python does not give you? Are there tasks where F# is significantly better than Python? AKA, did I forget what Lisp can do for me? I’m genuinely interested in hearing from you on this, but I do not currently see that in my work.

    @Miles: thanks for the URL, that’s a great post. You pinned me down incorrectly as a Tools guy though. I’ve been writing software on Linux for ~12 years or so, hence I’m very comfortable with a text editor + gcc/gdb/ctags (or what have you) sort of setup. My editor of choice is Vim (I actually had a religious conversion on that one), I love it and feel right at home in any language.

    At the same time, I write Windows software using Visual Studio + ReSharper + a ton of tools, and it’s an insanely productive environment.

    @Elias: that’s the education vs. pratice thing. Agreed it’s important on education, but what is the subset of professional tasks where Haskell will really make a big impact over, say, Ruby? Especially after you factor in realities like hiring, resources, libraries, open source projects, etc?

    I am _positive_ from experience that such a subset is not empty. I think it’s small though.

    Seu ingles ta otimo. Seu argumento fez sentido completo pra mim. Prazer, obrigado por postar :)

    @Ferruccio: Agreed.

    @miguel: Learning languages in vogue (or “one a year”, or generally pointless over dabbling) is _exactly_ what I tried to criticize in this post; what you describe is precisely what I mean by the “orthogonal set of languages” I believe is worth the while.

  10. Gustavo Duarte on April 25th, 2008 1:02 am

    Also, the post is fundamentally about trade-offs. Of course learning any language will teach you something valuable. The point is that there is _more_ valuable stuff out there that’s a better use of time. That’s the whole point. The title could have been something like “On the relative benefit of learning successive programming languages versus other forms of learning”.

    I think there is some extremely high value stuff we developers must learn beyond programming. For example business fundamentals or security, to use two examples from the post. Based on a diminishing returns argument, you can see why learning the 23rd language might not bring as much value as reading good books in those subjects, _even_ if there is value in the 23rd language.

    And also the reading high-quality source code thing. I think that’s HUGE to improve your programming, and yet it’s something less hyped (probably because it’s less fun) than learning umpteen languages.

  11. bmichaelsen on May 4th, 2008 4:38 pm

    The “pragmatic programmers” are right, when they say “learn a new language every year”. Its just good training. For someone who knows C/C++ and Java, learning C# might not really give a huge new insight in programming, but it is also really cheap (done in a week alongside normal work). Really understanding Lisp macros/GLOS or Ocaml with type interference or Haskell and Monads might be a bit more work, but _that_ is worth it too.

  12. The Zeitgeist » Failure to Adapt Considered Harmful… on May 11th, 2008 10:55 pm

    [...] Duarte, a programmer and blogger in Colorado wrote a very provocative article recently entitled Language Dabbling Considered Harmful where he reasons on why working, professional programmers should, more or less, stick to the [...]

  13. Michael Easter on May 12th, 2008 7:11 am

    I’ve blogged my response to this, but in a nutshell:

    There are several logical fallacies here. One of them is the “false alternative” between learning a new language and doing something deep such as algorithms, security, etc. There is no reason why one can’t do both at the same time.

    Also, the notion that one has to learn new libraries etc is patently false: there is a renaissance of languages on the JVM and CLR, which allow the use of the well-known, venerable libraries.

  14. Gustavo Duarte on May 12th, 2008 2:48 pm

    @Michael: I left a long comment in your blog post, but here was my take:

    1. It’s only a “false alternative” if you have unlimited time. So no, it’s not a fallacy under real-world scenarios where we have opportunity cost.

    2. There’s a world of difference between compiling, say, Ruby programs to run on the JVM and actually learning the Ruby way with its tools, particular libraries, and particular ways of doing things. Sure, you can access base facilities via the JVM, but where’s Rails? Where’s YAML?

    Learning enough of a language to write a simple program is trivial, with or without modern runtimes. My point is that: 1) I don’t think this learning is terribly valuable, and 2) to _actually_ become good at a language and truly groking it takes time. Should you do it?

    Of course, but in a purposeful way, which is why I talk about an orthogonal set of languages and all that jazz.

    Anyhow, this post is more than a month old so this argument has gotten tired by now, I’ll let this rest.

    cheers,
    Gustavo

  15. Remarks on Language Dabbling Considered Wasteful « tech guy in midtown on May 12th, 2008 4:09 pm

    [...] learning, Programming Languages Today I saw this well-written post by Michael Easter, refuting a popular (and well-written) post by Gustavo Duarte, titled “Language Dabbling Considered Wasteful.” Duarte argues that [...]

  16. Concerned Programmer on May 13th, 2008 1:14 pm

    “By that kind of argument we should all be eating LSD (don’t).”

    What’s wrong with LSD? Hofmann intented LSD to be used for building greater self-awareness and as an aid in therapy, and by most accounts it has been very successful at both.

  17. A linguist on May 14th, 2008 12:22 pm

    > This resembles human language: learning a second one changes the way you think and your perception of the world. The third or fourth, not as much. But it can’t be any two languages. If you know Portuguese and Spanish, your mind didn’t have to expand much.

    No, no, no! Why do some of you computer scientists/enthusiasts always make the comparison between natural languages and computer languages? This does not compute! Your native language or the languages you can speak do not determine your perception of the world (the notorious Sapir–Whorf hypothesis). Linguists do not believe in the Sapir–Whorf hypothesis, they only make “positive” references to it when telling jokes. OK, there are some weird people who claim to be sociolinguists (not that all sociolinguists are that weird!) who actually have a social agenda to run and who have a poor grasp on linguistics. Now anyone who has seen people with different native tongues can not say that they are radically different only because of their native tongue (the “only” is there bacause of the belief in the Sapir-Whorf hypothesis that is very common). Well, you can say that if you believe in dogma. Besides, how could it possibly affect your perception of the world if your basic word order is S(ubject)-V(erb)-O(bject) or S-O-V or O-V-S? Or if syllables in your native tongue are only C(onsonant)-V(owel) and not all of the myriad possibilities of, say, English, like C-C-C-V, C-V-C-C and so forth.

    Now please tell me where did you get your factoids regarding natural languages? Or is it “common knowledge”?

    The bulk of your article was spot on, by the way.

  18. Gustavo Duarte on May 14th, 2008 12:58 pm

    @Concerned: That was an attempt at a joke.

    @linguist:

    That example came from personal experience. I’m a native Portuguese speaker, English is my second language, and I know bits of other languages. I do feel that working in Portuguese versus English does affect my thinking. In particular, English has a very direct, pragmatic, no-frills feel to it, which I think affects analysis when I’m writing/thinking in it. Whether this is fundamentally due to the language, versus cultural aspects that show up through the language (ie, Portuguese is often long-winded, indirect, baroque), I have no idea. I also feel that knowing multiple (human) languages changed my thinking because I came to better appreciate the “layer of abstraction” over the world that language is. I say “feel” twice because this stuff is pretty subtle, it’s hard to nail down… maybe I believe these things due to the meme that that’s what happens, who knows? I’m ignorant of linguistics, hence I have no sound academic backup for the analogy.

  19. A linguist on May 14th, 2008 1:52 pm

    Might I suggest the now classic The Great Eskimo Vocabulary Hoax and Language Log. You might find them eye opening, or then not. The articles are also often really layperson friendly. Of course, as Language Log has numerous articles there are many that are not that interesting. I am also pretty sure that they have links to blogs in Portuguese about these same issues.

    I enjoyed also your other posts, by the way.

  20. Friedrich on May 23rd, 2008 12:33 am

    I disagree, if you do not take the time on learning different programming languages you won’t find those you like to use. I had to learn Modula-2 first and I hated this language, then then learned C and liked it. Then comes Eiffel and suddenly a whole new programming world shows. After that I learned Common Lisp, Scheme other functional languages and I can say it has changed my point of view about programming again.

    I’m still using C and are most fluently in it, but I also use Ruby regularly and I even tried such things like Erlang. Yes it takes time, but if I just think of beeing bound let’s say to C++ then I would give up programming sooner than later.

    No you should take the time learning languages the more different they are the better. At least one procedural language one OO language (not a mix like C++), a functional language.

    The world is not just Java, C#, C, C++ or whatever, even the simples program on unices do use at leat 2 language some Shell and some programming language. If you can’t read that code you can not judge about it.

    And it’s not good IMHO to spend all your life on poor programming languages if you do like programming

    Regards
    Friedrich

  21. Memoization - Motherboard chipsets and the Memory Map on June 13th, 2008 10:57 pm

    [...] Gustavo Duarte’s blog has some concise well written articles. I particularly like the post on Motherboard Chipsets and the Memory Map and language dabbling. [...]

  22. SDC on July 4th, 2008 8:26 am

    I wanted to hate you for this post but I can’t. I agree with yr hypothesis - after the novelty of a new language every year (every couple of months if yr extra motivated) wears off, you start to question the value of being able to do the same essential tasks 11 different ways.

    But I also remember when I started and saw ppl who used Ada their whole lives spend so much energy and effort trying to turn C++ into Ada so they could deal. One language doesn’t do it because your mind WILL be too narrow, but beyond a ‘basic set’ of programming languages, it is indeed wasteful.

  23. Gustavo Duarte on July 9th, 2008 5:03 am

    @SDC: hey, I checked out your blog, really liked the Dijkstra commentary. I’m hammered with work right now, but I’ve bookmarked it to leave some comments later on. cheers.

  24. Dorai Thodla on July 17th, 2008 5:56 am

    I like this post. I was born in India and had to learn 3 to 4 languages (one of them being English). I believe the language influences thinking in a very subtle way. I will just give one example. In Indian languages, relationships are very detail oriented. For example there is a different term for mother’s brother and father’s brother and even names for relationships nested a couple of levels deep.

    I always felt learning different languages is useful especially when you learn the idioms. Different categories of languages give you a different view of solutions. I started with machine code (direct binary, actually octal), assembler, macro assembler, Basic Plus, C, VB, Java and now dabble mostly in Python. I don’t code a lot now but would choose one of the high level languages if I have to.

    I think programming languages are still a bit far away from being close to several problem domains. DSLs may solve that problem (I love little languages), but we need to wait and see.

    This post and all the discussions are really fascinating. I am glad I found this blog. My entry point to it was “Lucky to be a Programmer” and I loved the post.

  25. Gustavo Duarte on July 17th, 2008 9:27 am

    @Dorai: that is an excellent point, DSLs. I am very much pro-DSL, I think there’s a lot of merit in using succinct, tailor-made languages for problems, especially declarative languages. Even tools like lex and yacc are a pretty good example of how well the DSL approach can work. The benefits of simplicity and fewer lines of code go a long way towards justifying learning/implementing a DSL.

    Thanks for the feedback also, I’m happy to hear you like the blog.

  26. Lorenzo’s Blog Thingy » Blog Archive » Language Weekend on July 26th, 2008 2:15 pm

    [...] think so (their eponymous book recommended learning a new language a year), though there are those that [...]

Leave a Reply