views:

1092

answers:

20

I have read numerous time that learning a language such as Haskell, Lisp or Smalltalk will somehow make you a better programmer while you program in other languages.

Is there more than just anecdotal evidence for that claim? Or is it just the way people rationalize having spend a lot of time learning a programming language that they will never use?

A: 

Different languages have different ways of implementing the same ideas. By learning new languages, you get a different perspective on how things can be accomplished, and can then use that knowledge to approach how you program in your current environment. Think about object oriented and functional programming. OO Programmers can learn a lot about parrellization from languages like C.

Kevin
+11  A: 

I don't have any hard evidence, but I have really appreciated the different way of looking at problems that I have since learning lisp (the same goes for python and c).

The key isn't necessarily learning different languages though, I believe that the key is actually the different viewpoints that you gain by learning different programming styles.

Good examples are functional, imperative, object-oriented, etc. Also, there are common design differences is interpreted vs compiled languages; static vs dynamic typing, etc.

Although most people do a majority of their programming using a single style (most commonly OOP over the past few years), I think that all programmers should know multiple styles so that they are better able to see the shortfalls of their own style.

chills42
An additional useful paradigm expressed in some languages is metaprogramming, both template (C++) and macro (Lisp). Learning to think in different kinds of abstraction can help understand the nature of problems and their solutions.
Michael E
Question for chills42; So, you didn't use lisp? And you knew you wouldn't use lisp?
Smandoli
Yeah, other than one or two simple emacs macros... I've never used it... The only reason I learned it was to try to be able to understand the language.
chills42
Cool! Thanks and well done.
Smandoli
+18  A: 

IMHO, it is all about learning a new programming paradigm. If you know Java and then C#, there's not much gain, once both of them have almost the same "type of programming".

But if you get to learn a functional language or dynamic, for instance, you're forced to think another way, and that will probably help you to program better in your favorite language.

It is something like: "It is so easy doing this in {different language you learned}. There must be a better way to do this in {language you already know}". And then you rethink, and build up a more elegant way to do this in {language you already know}.

Samuel Carrijo
My experience exactly with Lisp.
David Thornley
Question for David T: So, you didn't use Lisp, and you knew you wouldn't?
Smandoli
A: 

Learning a language, especially one that practices a new paradigm, is very beneficial for every programmer. For example learning Scheme will help someone understand functional programming. The programmer can later practice what he/she learned with other languages like C#. She can think of new ways of doing things.

Also, as languages evolve, it's high likely that the language you use will adopt some features of other languages. Having taught myself Ruby, I was able to grasp the changes in C# 3.0 much easier.

kgiannakakis
A: 

No use at all.

Smandoli
Have you even tried it yourself, at least once...?
peSHIr
Is this post self-referential?
John Pirie
"Have you even tried it yourself?" No, I'm too busy. To be dead honest, learning another human language will sharpen my brain better than another programming language. "Is this post self-referential?" That's a funny comment. Seriously, claims about "just learn another language" are mostly bogus. In my humble opinion, they come from a "self-referential" interest in computing rather than productivity or personal growth. That was the question, and that's my answer.
Smandoli
Okay, correction: That was the question, and that *should* have been my answer. An explanation of my mindset is sure to be more helpful than my original four words of btpthh.
Smandoli
A: 

I think learning languages will always benefit you even if you don't use them again. I started playing with Ioke as an attempt to learn something experimental and because of it my JavaScript has improved because certain ideas have been cemented.

learning a new language will possibly give you new insights that you will try translate to your main language.

AutomatedTester
A: 

I don't think there will be any hard evidence--I think this is more of an intuitive thing. Learning a totally different language will help you look at things totally different. Or maybe it won't. In any case, what's the harm in learning something?

mgroves
True. To stop learning is to die. My resistance is based largely on having a whole family and a half income. Sure, I have hobbies, but they don't happen to be programming, and that's all my time.
Smandoli
Check out Alan Stevens' Coding in Public http://www.vimeo.com/3898804
mgroves
If you spend your time learning Haskell, you have less time for other things.
Christian
A: 

It's entirely subjective, but way back when, after taking an undergraduate course in Haskell, I did notice that my programming style in C became more 'Haskell-like' for a while; I used a lot of simple, recursive functions. I also noticed that this programming style seemed to yield some of the same benefits programming in Haskell had; bugs were fewer, code was easier to understand (albeit slower).

So, while learning another programming language may not make everyone a better programmer, it definitely was a learning experience for me, personally.

Michiel Buddingh'
+3  A: 

Can't shed much light on this in terms of programming languages, but it seems very similar to the "why learn a dead language?" argument that surrounds Latin, and much of the reasoning there can be applied here.

Jonathan Deamer
+1 for bringing out Latin. Now I cannot say more than rosa, rosae, rosam, rosas... but I think it was a delightful experience that helped me to know more about my mother tongue :-)
fortran
A: 

What are the benefits of learning mathematics or physics that you won't use, or the benefits of studying philosophy or dead tongues?

It's the intellectual achievement and the enlightenment what matters, you will be a wiser person with any new thing that you learn, no matter if they are programming languages, literature, role playing games... of course if it's related to your working field, then you'll actually find a use, sooner or later :-)

fortran
A: 

I spent some time studying clojure even though I knew I wouldn't use it in the near-term (mostly because I can't really deploy on the JVM).

It has concepts that aren't supported by the languages I use (C#/C/C++/Python/Perl) and I wanted to know what I was missing and also if it would be worth looking into libraries that purport to add these features.

Specifically, I'm very interested in understanding Lisp-style macros and the direct concurrency support. I also spent some time reading the implementation, specifically the datastructures, which was very educational -- good to see a quality implementation of persistent datastructures to learn how they work (and give you immutability without sacrificing much performance).

Lou Franco
+2  A: 

A great side-effect of learning new languages is the potential for application in your existing language.

For instance, I'm a Java programmer and I took the time to learn my first functional language (Haskell). I was recently asked to learn Scala for an upcoming project. This is extremely easy since I understand the comcepts of guards, recursion, etc. from Haskell.

Zack
+3  A: 

Programming is a way of thinking, not writing code in programming language X: that is "coding", not "programming".

By knowing at least something about more than just one programming language - preferably across different paradigms, so imperative/OOP/functional/logical - you train that way of thinking about problems outside the context of the specific details and quirks of language X.

I think this always improves your abilities to be(come) a better programmer tremendously.

peSHIr
+1  A: 

Deeply learning language just for learning language has too little benefits. If you have a lot of tasks and you don't know language that ideal for solving it then it is make sense to learn that language. Otherwise it is make sense to spend the time to become expert in languages you already know.

Kirill V. Lyadvinsky
+1  A: 

I don't know that there will have been much rigorous study regarding the benefits of multi-programming language exposure on overall programming ability, but I would argue that the studies regarding why learning a foreign human language (which you may never use in practice) is beneficial would in general hold equally well for studying foreign programming languages. The benefits ascribed often include improved cognitive abilities as well as improved understanding of one's native language.

here's some links to studies

anecdotally, I complained a great deal about taking COBOL, and have never really used it but was able to apply things I learned in that class at my first job.

cmsjr
+1  A: 

If you give any credence to the Pragmatic Programming guys, consider their advice from page 14 of their first book:

Learn at least one new language every year. 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.

Don Wakefield
Amen. But ... a language you know you will not use?
Smandoli
+1 for Pragmatic Programmer
DoxaLogos
@Smandoli - if that language brings a new paradigm to solving a problem. Yes, it may even if not used ever again.
DoxaLogos
" ... Not Used Ever Again." So, the language was used.
Smandoli
@Smandoli - the Pragmatic Programmers make no distinction about direct application of each 'yearly language'. I think the brief quote is very clear: learn different approaches, broaden your thinking, avoid ruts.If instead, I ask myself "will I *ever* use this particular language *directly* in my *paying job*?", well, it's a rather petty perspective, and you cheat yourself.So in brief, "a language you know you will not use?" - yes, emphatically.
Don Wakefield
@ Don -- That's a good clarification, thanks. Part of my interest in this question is a philosophical look at construction of meaning. I preferred a narrow construction, which for you works out as a petty perspective. The community prefers a broad c. and I thus become a contrarian, although I disagree less than folks probably think.
Smandoli
@Smandoli - sure. I struggled to find the right word. I chose petty, but that is perhaps too pejorative. Limiting? Constraining? I hope you take my point, and that it's not meant to be a putdown.
Don Wakefield
+1  A: 

Some examples that come to mind:

Knowing C and having to deal with memory management and do-it-yourself data structures can help you understand performance issues when programming in a higher level language where those details are hidden from you.

Conversely, learning an OO language can affect your C programming - with, for example, the concept of Polymorphism prompting you to use function pointers in ways you might not have otherwise.

Learning a language where functions are first class objects that can be passed around can make you think of similar techniques in other languages, even if, in those other languages, you have to make the functions methods in objects that get passed around.

Learning about the way Erlang handles concurrency can make you rethink how much shared state you use between threads in other languages.

Any language that has a built-in feature you find useful can prompt you to implement your own version of that feature in another language that doesn't have it, and thus allow you to solve problems in ways you might not have thought of if you hadn't been exposed to the feature in the language that has it built-in.

Learning about Interfaces in Java can make you think about the benefits of precisely specifying your (small "i") interfaces in other languages that don't have them as a formal construct in a type system.

No doubt there are others.

Anon
A: 

Bryond what has already been said, I really like new languages just because it can bring new interest to programming. You learn different ways to approach problems and the strengths/weaknesses of certain languages. It is something new to learn and any good programmer should be striving to always be learning new things. It mixes up your daily routine of possibly programming in the same language for years.

I also like what everyone has said about programming perspective.

Troggy
+1  A: 

Learning a language is not a binary event. If you are a decent programmer, you should be able to trust your own instincts as to whether a language offers you a new take on your craft.

Virtually every language worth considering these days can be downloaded and test-driven in a couple of minutes. So do it -- pick one and try it out.

There are a limited number of cases where this "laissez-faire" approach falls short. If you're a complete beginner, of course it doesn't work. When I first learned C, I had to have it beaten into me, but it did turn out to be worth it because it made me understand pointers, memory reference and dynamic allocation in a way I hadn't previously.

But if you know that much already, just poke around and look for a language that makes your lightbulb go on.

John Pirie
+1 I like this answer. But I wonder if there's an opening premise of "I might use this language." Probably not. Probably my own projection.
Smandoli
A: 

Some good points have been made.

I would add that learning languages you won't use in production work can be of value

  1. To better appreciate and absorb the arguments and methods in texts and papers that will improve programming ability in languages I do use for production work (e.g. MIX/MMIX for Knuth's Art of Computer Programming; RATFOR for Kernighan and Plauger's Software Tools; I still use some ALGOL-based syntax for some pseudocode although I never wrote runnable code in ALGOL outside University)

  2. To be able to check or prototype programs that will be written in a different language (e.g. some routines for numerical computing in C can be quickly checked or scaled using languages that have appropriate functionality built in such as Fortran, Python or Haskell)

  3. Learning a new language can give insight as to how it could be used to more easily solve problems that were put to one side because of time or complexity constraints.

mas