The Pragmatic Programmers suggest learning a new language every year (The Pragmatic Programmer, page 14). I think they’re right, but I think their blanket statement needs clarification. Here’s the actual quote:
Different languages solve the same problems in different ways. By learning several different approaches, you can help broaden your thinking and avoid getting stuck in a rut. Additionally, learning many languages is far easier now, thanks to the wealth of freely available software on the Internet.
Some people disagree, saying that it’s impractical to do and maintain. A very small selection:
- “‘Learn one new language every year’? Yeah, right.” suggests that this is impossible: “After a year’s experience with each language I hadn’t even scratched the surface of what that language had to offer.”
- “No New Language in 2009; New Habits Instead” is fairly blunt in calling bull***t, saying that the benefits of new languages don’t actually offer you that much (quoting Alan Perlis in saying that languages that don’t change how you think aren’t worth knowing, and extrapolating from that), but focusing on the literal impossibility of mastering a language in such a short time.
Personally, my struggle has been finding an application that justifies the new languages, even though I can look at a language and see almost immediately where features might be useful. Those useful features tend to exist in a silo, though.
For example, Scala is great, but I don’t use it much because there’re not enough cases where its features are required, and without those features being mandatory, it’s hard to convince a team to add to their body of knowledge just to support your wonky new language preference… that will change next year.
Likewise, Groovy is great, but… see Scala. Scripting support is nice, but it’s… nice, not often required.
[Aside: Codehaus – the site that hosted Groovy back in the day – is gone. Want to know more? See “The 10 Most Important Projects Hosted on Codehaus.org” – and if you’re interested in Groovy itself, well, it has a new home as well.]
Jython and JRuby have the same issues.
(If you can’t guess: some of the languages I’ve learned recently (not, perhaps, at the rate of one a year) have been Scala, Groovy, Python, and some Ruby. Among smatterings of other languages.)
I support the Pragmatic Programmers’ statement, though, and here’s why.
- Learning new languages doesn’t necessarily mean mastering those languages.Again, an example (using my new-language-of-choice of last year): Scala. Learning Scala exposed me to what Scala considers important. I can take that and apply the concepts to other languages, like Java. I also learn what capabilities Scala has, so that if I should happen to need them, I have them in my toolbox, so to speak. Learning new languages gives you different views of what communities are and can be.The C# community is much more “orderly” than the Java community; someone coming from Java’s rough-and-tumble environment is likely to enjoy the lack of noise. Conversely, someone coming to the Java language from C# – Oh lord, WHY? – will probably recoil at first and then see how beneficial having a harsh best-of-breed environment is. The languages reflect their communities and vice versa. Thus, TheServerSide.net, which focused on .NET technologies – was traditionally far calmer (fewer flamewars, less actual discussion, less transfer of knowledge across boundaries of familiarity) than TheServerSide.com, which focused on enterprise Java.
(I worked for TheServerSide.com as editor for a few years, leaving in May or June 2008, and I still write articles for them every now and then.)
One community’s approach isn’t “better” than another’s, really; they’re just different. (Eric Raymond might disagree; please read The Cathedral and the Bazaar for more details.)
- Learning new languages gives you a fresh pair of eyes.I’m usually pretty good at this. (I don’t know what it says about me that I’m good at being a newbie.) Even so, I still automagically “fill in the blanks” when using languages with which I’m familiar.Switching languages lets me see what information is missing, because when I switch, I don’t know what the experts know. This allows me to talk to the experts (hopefully) and help find what information should be included, but isn’t.This was part of why I took on TheServerSide.com, actually, and why I took a job at GigaSpaces Technologies. And why I use OSGi. And why I use JCR. And why I use… ad nauseum, really.
- Mind the quote: it doesn’t say “master a new language every year, and maintain said mastery.”Just learning the new language is a lot easier.I used to be considered good at C++ (at least, according to my peers and Brainbench and stuff like that.) I can’t prove that that means anything, and honestly, it’s hard for me to believe that it’s a true statement. I know too many people who were really fantastic at C++ to count myself in their number.Times have changed; now, C++ looks very, very strange to me. I could pick it back up quickly, I think, but VM-based languages like Java and C# (and related languages) are too good for me to worry about C++ all that often.
One of the criticisms mentioned early on was based on the idea of having to gain experience in each of the languages learned, year after year. It’d be a fully valid criticism if you understand the edict to literally indicate gaining mastery, but I don’t think that’s what was intended.
Look, it’s definitely a good thing to not only be aware of what the languages say they can do (hello, Ruby, nice to see you here) but to actually try to use each language in anger; this helps get you past the starry-eyed phase and into seeing the grimy details.
“In anger” means “with real intent,” thus to “fire in anger,” meaning shooting to kill, or – in a less aggressive usage – “use ant in anger,” meaning using ant to build a project that has actual use. There’s an ant tutorial by this title, and it’s where I came across the phrase first.
Reading unfamiliar syntax in a tutorial is good – that’s what tutorials are for, after all – but you don’t really internalize the syntax or what it means until you really use it. You’re still at the infatuation stage, and such tutorials are usually written to encourage an enthusiasm for the subject at hand; they’re not going to say “Well, okay, we understand that (+) looks, um, slightly laughable, even though it really does something useful.” (It creates an anonymous function, taking two parameters, returning the result of them added together.)
Sometimes, the proper result of grokking a language’s syntax is and should be “YUCK! Keyboard vomit.” (Why, hello, Perl. It’s been a while, and it’s nice to see you again.) Tutorials won’t give you that; using a language in anger will.
Don’t let learning a new language get in the way of remembering your “primary” or “most useful” language. I know Python, Ruby, Scala, and Groovy (listing the recent ones, and not grading myself in any of them) but when I need to actually get things done, I still get them done more efficiently in Java, as long as “more efficiently” doesn’t mean lines of code.
But I have to say: learning C# has been a real eye-opener in terms of not only language features but application. The change in surroundings is well worth it, even if I don’t use C# as my “primary language” (which I probably won’t, considering that I use too many operating systems to not have to rely on Mono, and … I refuse to rely on Mono. Miguel’s .. not a traitor, but dadgummit, he seems like one. Sorry, Miguel.)
Author’s Note: Yes, repost.