100

I'm quite proficient with Java, C/C++, JavaScript/jQuery and decently good at Objective-C. I'm quite productive with the languages and their corresponding frameworks too and do produce enterprise level systems (and also small scale ones) with sufficient ease all the while keeping code 'clean' and maintainable (yes, I can read my own code after six months :)

Unless mandated by the platform (iPhone, iPad, etc.) or by the client/implementation organization, just "why" should I learn a new programming language? Just for "fun"? And do what with that fun if I'm not going to do anything worthwhile with it?

A lot of my peers are ready to dive in to learn the "next new thing/language" and it's usually Python, Ruby or PHP (just naming a few popular ones). Now, just knowing the language by itself is futile IMHO. You also need to know the frameworks, learn their usage/APIs as well as 'good implementation practices', etc.

So from an 'economic' sense, is there any benefit in learning a new programming language? If the language is learned in a quick and dirty fashion, it'll probably also be used for quick and dirty prototyping/implementation - but I don't see THAT as a justifiable investment of time/effort.

So just WHY should I (or anyone for that matter) learn a new programming language other than "it's fun so let's try it out" - if the investment of time may not be worth it in the long run?

Peter Mortensen
  • 1,050
  • 2
  • 12
  • 14
PhD
  • 2,531
  • 2
  • 18
  • 32
  • 6
    http://programmers.stackexchange.com/questions/118338/becoming-a-polyglot-programmer/118356#118356 Maybe you'll be interested by the answer I gave gere. – deadalnix Feb 21 '12 at 17:28
  • 3
    If you can see a new language with new concepts and not have a desire to understand them, many places won't hire you (in fact, many interview questions are made to specifically determine things like this) – Bill K Feb 22 '12 at 00:03
  • 3
    I'll ask why shouldn't I learn a new language? – user Feb 22 '12 at 01:43
  • @Caleb: Not a rant. Genuine question since I was evaluating RoR and PHP for the next project we are going to work on and I asked a related question on effort differences: http://programmers.stackexchange.com/q/134589/18748 - since we got 'excited' to implement the next thing in a 'new' language – PhD Feb 22 '12 at 05:08
  • +1 | @Nupul You might want to read ["Profession" by Isaac Asimov](http://www.google.co.uk/search?aq=f&sourceid=chrome&ie=UTF-8&q=isaac+asimov+profession), which explores the concept of learning capacity. It's a short story and will probably only take a couple of hours to finish, but I really think you'll enjoy it. – m-smith Feb 22 '12 at 09:42
  • If I were to interview a programmer and found that he only knew Java (or any other 1 language) I am pretty sure I would end the interview pretty soon. I don't want a one trick poney – Zachary K Feb 22 '12 at 11:03
  • 2
    @ZacharyK even if the job was for a java developer, and the candidate was superduper at java. Sounds like you might be shooting yourself in the foot. – NimChimpsky Feb 22 '12 at 11:09
  • 2
    There are lots of Super Java guys out there. I am as interested in what you will know in 6 months as what you know now. (Of course I seem to spend all my time in Erlang, CoffeeScript and PHP) – Zachary K Feb 22 '12 at 11:22

17 Answers17

182

From The Pragmatic Programmer, Tip #8 "Invest Regularly in Your Knowledge Portfolio":

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. Additionally, learning many languages is far easier now, thanks to the wealth of freely available software on the Internet

It's not about the next "new thing". It's about thinking in different ways outside of your normal thought patterns.

There is a saying, "When you're a hammer, everything looks like a nail". Maybe there is a better way to solve a problem using some other technology. If you don't explore, you may not know that it was available.

yoozer8
  • 693
  • 1
  • 8
  • 20
jmq
  • 6,048
  • 5
  • 28
  • 39
  • Excellent point. This thinking is what led me to try RavenDB on a project, and I learned so much after years of being stuck in a SQL Server rut. – Bob Horn Feb 22 '12 at 04:25
  • 54
    I thought it was when all you have is a hammer everything looks like your thumb – Zachary K Feb 22 '12 at 07:46
  • 2
    I completely agree. I'd also add that learning another language helps you to better understand aspects of languages you previously thought you knew. It also helps to distinguish what are "real" programming fundamental concepts/patterns/limitations, and what are merely artifacts of your particular toolset. For instance, if all the languages you know are weakly typed, you might never know that strong typing exists, and never wonder why! Consequently, your products might suffer in performance or safety, even though they might excel in time-to-market ;-). – JJC Feb 22 '12 at 12:24
  • 3
    The Pragmatic Programmer is one of the best programming book I have ever read. Really good! – Soner Gönül Mar 02 '12 at 13:14
  • I really agree on "It's about thinking in different ways outside of your normal thought patterns". When I learned Python, I got the new world of a way of thinking. – Yoo Matsuo Mar 07 '13 at 00:15
  • Also check [How many programming languages should a developer know fluently ?](http://www.quora.com/How-many-programming-languages-should-a-developer-know-fluently) – Shaiju T Sep 15 '15 at 09:50
80

Why do people climb Mt. Everest? Or run 100 Miles in 24 hours? Why do we undertake any challenge? Because it's there. I see nothing wrong with "Ars gratia artis". There comes a point where learning for learning's sake becomes it's own reward. But if you want more powerful reasons to learn a new language here are some:

New ways to solve problems Learning a new language, really taking the time to dive in, gives you the chance to program again as a newbie. That new perspective can teach you techniques that might carry over to an old language. Think of the influence Ruby on Rails had on ASP.NET MVC or how Java Hibernate was ported to C# (along with countless other frameworks that influence .NET development). Exposure to different languages can teach you new ways to address problems.

The right tool for the right job All of the languages you mentioned are OO/Procedural hybrids (or purely procedural in the case of C). Try your hand at a Functional language or two. Try implementing factorial in Erlang using recursion and watch your jaw hit the floor when 20000! returns in 5 seconds (no stack overflow in site). Then look at the power of scaling your application to crunch through numbers and parse protocols with less code and in less time than it would take to get two instances of a JVM talking through RMI or SOAP. Learning other languages/frameworks that are targeted to solve specific problems will give you more tools.

Meet new people/expand your network Diving into a new language exposes you to a new community. Meeting new people is a good thing for your career and personally.

New opportunities Knowing a new language can only increase your chance of getting that job with that hot startup. "Man this job would be perfect if I knew Ruby." Besides, you might enjoy the language enough that you decide to switch paths.

Keep it fresh Working with the same thing day in day out becomes tedious. Using a different language can give you a break from the daily grind and allow you to come to the next day refreshed.

Because it's there Learn a new language because you want to.

Michael Brown
  • 21,684
  • 3
  • 46
  • 83
  • 3
    +1 Javascript can be functional, but it certainly looks like the OP maybe missing a few paradigms from their toolbox. And more experience with functional languages will give deeper insight with their existing languages e.g. with C++ templates – jk. Feb 22 '12 at 12:32
  • +1 for Keep it fresh , it realy does feel good working on something different – Mona Feb 22 '12 at 15:17
  • I'd like to point out that tail-call optimizations have nothing to do with whether a language is (pure) functional or not, imperative languages compiled to run under the .NET 64-bit runtime get tail-call optimization for free for example. – Blindy Feb 22 '12 at 20:51
  • 1
    LOL, yes that is not what makes Erlang a pure functional language but it's a total change in perspective. In imperative languages we are encouraged to avoid recursion for all but the most trivial cases and Functional languages recursion is a way of life. Pattern matching as opposed to if/else or switch/case are pretty cool too. – Michael Brown Feb 22 '12 at 21:00
  • 2
    _Try implementing factorial in Erlang using recursion and watch your jaw hit the floor when 20000! returns in 5 seconds (no stack overflow in site)._ This is one of the strongest arguments for learning a functional language I've ever seen. Never thought that it could be so efficient. – Alec Mev Nov 23 '12 at 11:47
  • 20000 multiplications take 5s? Are you serious? – Ingo Feb 25 '13 at 22:30
  • My jaw dropped when it happened...I didn't believe it. but yes. There were a lot of zeroes at the end. Reminds me of the joke about the guy who stole the last ten pages of a printout of a lisp program all he saw were close parentheses. – Michael Brown Feb 25 '13 at 22:39
  • @Mike Brown: From the tone of the joke it seems it is ironic. :-) I am learning some Lisp (Scheme and Common Lisp) right now (for me it is quite new having done mainly Pascal, C, C++ and Java before) and the parentheses are not disturbing at all (considering that most editors will highlight matching parentheses and that there is a specific layout / style for writing Lisp code): when you get used to it you see the structure of your functions and nothing else. – Giorgio Feb 26 '13 at 13:25
  • @Giorgio it's definitely a joke and not a shun on the language at all. I never learned lisp myself but I'm having a blast with Erlang. – Michael Brown Feb 27 '13 at 15:18
  • @Mike Brown: I have Erlang on my to do list too. I would like to try to implement concurrent algorithms (e.g. merge sort). I have also taken a look at actors in Scala, which as far as I know are based on the Erlang actor model. All very interesting stuff. :-) – Giorgio Feb 27 '13 at 18:44
  • But why is it so slow, then? On a lame i3 processor I get this printed in 3.4 wallclock seconds with a JVM Language (i.e. the startup cost of the JVM is included in the 3.4s) – Ingo Mar 12 '13 at 00:26
38

We think with words. The language we use influences the way we do it. There's an interesting case about Pirahã language - people speaking that language can't handle as something apparently "simple" or "intuitive" as numbers because the language they have been brought up in has no words for "specific quantities" (not even "one" and "many").

With programming languages is the same. A new programming language, can "open up" your mind to some aspects of programming.

Given your current programming background, I recommend you to learn some functional language, like Erlang or Scala. Finally, Clojure is a very solid language, too.

If you want to feel a bit more at home first, try a powerful scripting language like Python or Ruby.

egarcia
  • 291
  • 2
  • 7
  • 23
    +1. "A language that doesn't affect the way you think about programming, is not worth knowing." -- [Alan Perlis](http://www.cs.yale.edu/quotes.html) – ruakh Feb 21 '12 at 19:08
  • 2
    I reject the premise that “We think with words” as it denies the possibility that anyone (or anything) without words can think. But words _are_ extremely useful for labeling concepts (and so helping to distinguish them). We _mostly_ do our higher thinking with (much involvement from) words because it is efficient. Which is a more equivocal statement, but I think closer to the truth. Funnily, I can't reject the use of words without using words… – Donal Fellows Feb 21 '12 at 23:06
  • @DonalFellows : I think we have some "mental processes" that are not expressible through words. But I don't call those "thoughts", but "feeling", "reflexes", "intuitions" etc. I think a proper thought must be expressable in terms of some sort of language. So to me something that doesn't have a language can lives, processes, react, feel ... but not think. But this is a belief, based on intuition, not any real evidence. And also a bit off-topic, really :) – egarcia Feb 21 '12 at 23:33
  • Absolutely agree, learning languages just because they are the new cool programming language makes no sense. You should stick to very different ones, and try not to cover too many of them. Being good at something will take a considerable ammount of time (probably 10+ years), it doesn't matter if it is playing a musical instrument, cooking, or programming. – Mister Smith Feb 22 '12 at 10:01
  • @Donal: At least you don't think correctly when you state that "We think in words." means "anyone (or anything) cannot think without words." Compare: "Humans have two legs." does not deny there is something that has 4 or more legs or none at all. – Ingo Feb 22 '12 at 10:11
  • @Ingo I'm not convinced that that's a correct analogy, and it's not universally true anyway (some humans have fewer because of accidents; occasionally some unfortunate has more because of genetic/developmental problems). A more accurate analogous phrase would be “We walk with legs.” which expresses something about the definition of “walk”. – Donal Fellows Feb 22 '12 at 10:39
  • That said, the core of my objection is that I suspect I don't _just_ think with words. Much of my programming is guided by other modes of thought (pictorial?) and I most certainly would put my effectiveness down to my ability to do that. Its only later that I translate that into words. I also do not wish to deny that non-humans can think; I'm fairly sure our cats think, though in a cat-ish way and without words. (You can't expect a cat to think a lot like a person; they have really different priorities, though understandable ones.) – Donal Fellows Feb 22 '12 at 10:43
  • To add to this linguistic-ish debate; the Pirahã people can in fact do basic maths. They just don't use the Pirahã language for it (sadly though, I can't remember the source my linguistics prof used for this). I'd say words are a tool for thought, and different tools affect the way we think about a problem in different ways. – evilcandybag Feb 22 '12 at 11:04
  • @evilcandybag: I'm not so sure. My understanding is that if you show a Pirahã person a picture with a certain number of lines, and ask them to copy the picture, they'll get the number of lines wrong (except by chance), *even when still looking at the picture*, because they just don't have this concept of "same number". (And the Pirahã are overwhelmingly monolingual, so they're certainly not using a *different* language for math, if that's what you mean.) – ruakh Feb 22 '12 at 11:49
  • @ruakh: Since none of us can demonstrate an actual source for our claims, let's just quit here before we turn this into an Argument On The Internet (TM) =) – evilcandybag Feb 22 '12 at 15:54
  • 2
    @evilcandybag: As it happens, I actually *can* demonstrate a source: http://www.sciencemag.org/content/306/5695/496, http://www.sciencemag.org/content/suppl/2004/10/15/1094492.DC1/Gordon.SOM.pdf (PDF). – ruakh Feb 22 '12 at 16:12
  • For anyone not conscious about the HUGE impact language has on thinking, reading about Newspeak in George Orwell's 1984 will be an eye opener, http://wikilivres.info/wiki/Nineteen_Eighty-Four/Appendix_-_The_Principles_of_Newspeak. – hlovdal Feb 23 '12 at 10:54
26

Not only do you want to learn new languages you want to learn languages that are different from the ones you know already If you know Java learning C# will not really challenge you, they are fairly similar. Ideally you should pick a language that is very different from what you know. If you know java, JavaScript and Objective-C you want something very different

Such as:

Ruby a fun weakly typed OO Language

Prolog A logic programming language very different

Erlang Concurrency and Fault Tolerance done very well

Scheme Go read SICP and reach enlightenment

Haskell One of the most powerful type systems in the world if it compiles it will probably work, also will keep you from making all sorts of strange errors and lot more.

Or just pick up Seven Languages in Seven weeks which will do about what the title says it will.

Zachary K
  • 10,433
  • 2
  • 37
  • 55
  • 2
    +1! An exercise I am doing right now is to implement the same algorithm (merge sort) in different languages: this really gives me a feeling of how many ways there are to express the same computation. I have already the C, C++, Pascal, Java, Scala and Haskell versions running. Python, Ruby, Modula2, Scheme are on their way. I find you can learn so much by looking at different programming languages! And by doing one thing in one language I can get many ideas on how to implement it in a better way in another language. – Giorgio Feb 21 '12 at 22:39
  • 3
    I like this _except_ for how you describe Haskell. You can still write wrong code that compiles. (Type-correctness is not the sole requirement for overall correctness.) The reason to learn Haskell is that it is notationally very close to mathematics, and it has a lazy evaluation model; that should shake up most programmers' notions of what programming is all about. – Donal Fellows Feb 21 '12 at 22:55
  • I think should give Prolog a try. When I first learned it, I became amazed. How you can do things only writing few characters. – user Feb 22 '12 at 01:47
  • 3
    @DonalFellows in my experience if you get the types right in Haskell, the rest of the program tends to write itself. – tobyodavies Feb 22 '12 at 01:53
  • I think saying that a program that compiles is correct in Haskell is a bit of an exaggeration. It's probably more accurate to say something like that about dependently typed languages like Agda, but they start to blur the line between your program and the type system. (That's why they're called dependently typed--the types can depend on *values*.) – Tikhon Jelvis Feb 22 '12 at 02:06
  • @giorgio do you have that code online somewhere I would love to see all the different versions – Zachary K Feb 22 '12 at 07:47
  • @Zachary K: I wouldn't know where to post it, I do not have a blog, but I could mail it to you if you are interested. – Giorgio Feb 22 '12 at 08:14
  • @tobyodavies It's quite easy to conceive of programs that are type correct but wrong. For example a program can easily select the minimum item from a list or the maximum item from a list. The type signatures are the same (in Haskell and most other programming languages too). Yet a program that mixed one up for the other would be still be wrong. Being off by one at a complex loop boundary is another common problem. These are not type errors; these are logic errors. I _suspect_ that any type system cannot catch all problems; you can always have a higher-order issue to foul things up. – Donal Fellows Feb 22 '12 at 09:24
  • @DonalFellows Oh sure there are errors that type systems will never catch, but it can still be a major help – Zachary K Feb 22 '12 at 10:14
  • @ZacharyK Reading comprehension fail! :–) I didn't say that type systems don't help. I said that they don't catch everything. – Donal Fellows Feb 22 '12 at 10:34
  • @Donal Fellows: I agree with you: Haskell is a big paradigm shift and it took me some time before I started to feel comfortable with it (but wasn't it the same when I learned C or C++? Yes, it took me quite some time), but now I like it more and more. You can write code that is so clean and concise! I am planning on doing some serious development with it. – Giorgio Feb 22 '12 at 11:48
  • +1 for the Prolog recommendation. Also I'd posit that SQL is a language worth learning (correctly) for similar reasons. – fluffy Feb 22 '12 at 16:50
  • @Zachary K: I wanted to send you a message regarding my programming exercise but I do not know how to do it on this site. Is it possible? – Giorgio Apr 21 '12 at 22:12
  • I don't think so, I am zkessin on twitter though – Zachary K Apr 22 '12 at 02:23
  • @Zachary K: For some reason I overlooked your answer and only saw it today. It's been a while ago. Also, I am not on twitter and I did not find a way to write you without signing up. Anyway, some of the code is now on sourceforge as project algvar. It is alpha code and I am only working on it in my spare time so it is evolving quite slowly. But I find it a good exercise for learning new stuff and comparing programming language concepts. – Giorgio Feb 25 '13 at 08:26
  • No Idea, how to do it. Post a gist with the examples would be how I would share them. – Zachary K Feb 25 '13 at 11:07
  • That's exactly what I did: The whole source code is on sourceforge.net as project algvar, and can be checked out using SVN or browsed online. – Giorgio Feb 26 '13 at 11:57
  • 1
    "Ruby a fun weakly typed OO Language": Is Ruby really weakly typed or rather dynamically typed? – Giorgio Feb 26 '13 at 13:11
  • @Donal Fellows: From a course I attended recently I understood that some type systems (e.g. Haskell's) are sound (they ensure certain properties of programs) but not complete (they cannot ensure all properties of programs). You cannot have a type system that is sound, complete and whose type checker always terminates. From what I understood, the good thing about Haskell's type system is that it is sound (what you can prove through the type system is guaranteed to be true by the language specification), whereas other type systems are not sound (a program that type checks is allowed to crash). – Giorgio Feb 27 '13 at 08:31
15

Your question is such a leading one that it begs me to ask the following question:

If you are programmer by profession, why in the world wouldn't you want to learn something new to add to your professional experience?

Your question sounds to me a lot like the attitude of a student I once had. A year or two before Y2K I was teaching a Cobol class (as an elective), at the request of the Director of Career Services at the university where I was teaching at the time. He had so many companies approaching him with job opportunities for Cobol programmers that he thought we would be doing our students a disservice by not giving them the opportunity to learn the skill and add to their skill set.

I had a student who took the class as his last elective class to graduate. He was also working as a C Programmer at the time. He took the Cobol class because he had no other choices and he wanted the degree. So he came to the class with a chip on his shoulder.

I already know C, and I'm using it professionally so I don't know why in the world that anyone would want or even need to learn Cobol.

So I challenged him with the task of writing a program to read data from a file that had a specific format for each record of input (ie how many characters each field took up on a line, which field came first, second, third, etc.)

He was to write his program in C, which he did, and he showed off his program to me. At the same time, I showed him my Cobol version of the program.

Then I threw him a curve ball:

Supposed that the end user is getting data from somewhere else. It's the same fields in each record, but the order and the number of characters per field is different. Show me what you would have to change in your program to make it work with the new data format.

He took a day to make a new version of the program that worked with the new data format. It involved changing at least 20 or 30 lines of code, and modifying several functions and modules.

Then I showed him the changes I needed to make to my Cobol program. I modified the picture clause to reflect the new data format.

I'm not sure he completely understood the lesson of that exercise, but he at least quit complaining for the rest of the semester.

So - in answer to your question: You should learn new languages because you want to LEARN. And if you don't want to learn - more power to you... (I'm just not sure I would hire you with that attitude)

Zeke Hansell
  • 952
  • 6
  • 11
  • 6
    While your intentions were good, if I were that student I would simply think that the only reason your app was easily changed was because you knew of the eventual requirements change. If the program were written in C with the same knowledge, minimal changes would need to be made there as well. – hspain Feb 21 '12 at 22:47
  • I had a coworker with a similar attitude: "C and PHP earn me money. Why should I waste my time learning another language?" He doesn't work there any more. – greyfade Feb 22 '12 at 00:44
  • 3
    all requirements change sooner or later! That is kind of the point. – Zachary K Feb 22 '12 at 07:48
  • @hspain - actually because of the whole point of the exercise is that Cobol treats I/O specifications as a first-order part of a program, rather than something that happens in a laissez-faire manner based on the way you wrote and orderd your I/O statements in C. And to echo Zachary K's comment, the fact is that requirements change. - Yes you could structure a program in C in such a way that it is less brittle when such things as I/O requirements change, but that involves thinking about the program in a completely different way than you normally do when writing a C program. – Zeke Hansell Feb 28 '12 at 20:47
  • I did not know that about cobol actually. Someday I may have to go take a look – Zachary K Feb 25 '13 at 11:10
12

There are several reasons why learning a new language may be worth an investment in time:

  1. Increase the size of one's tool box - learning a new language can provide additional paths to solving technical issues. The possibility of new tools could provide a better choice of language/platform for solving certain problems than the tools/languages that one previously knew. A simplistic example might be that of a programmer who only knows C. Learning a scripting language opens up other possibilities for him/her - in terms of deployment, environment set up, etc.
  2. Gain access to a new platform - an excellent example might be Objective C - if one wants to develop for iOS, learning this language is almost mandatory.
  3. Learn new paradigms - certain languages might have better access to newer paradigms. Using C as an example, it might be difficult to develop web services in standard ANSI C. However, learning to develop in .NET, Java, PHP, or other new languages might speed development of web services.

Learning new languages can provide immediate benefits, as you've already noted, in "quick and dirty" solutions. However, these immediate solutions might lead a programmer to investigate and dig deeper into the architecture associated with the new language to "properly" learn it. One can view these quick learning exercises as an investment into the investigation of whether a new language is worth addition training time.

JW8
  • 2,669
  • 3
  • 21
  • 22
11

In a word: Marketability.

You open up your employment prospects when you can display that you have the ability to adapt and learn new things. Sure, you could keep writing applications using the one language you have become really proficient at, but what happens when you learn that your favorite language of choice becomes irrelevant for the industry that you have been working in. I actually remember a time when we used to write our own web services from scratch in C or C++, nowadays we use tools that do all the underlying "webbiness" for us (Think Rails, etc...).

The point is, you end up like those actors who do a TV series, and then can't easily move onto anything else because they are forever seen as their original character. "Who on Earth wants Captain Kirk to be Indiana Jones?!!". The same with programmers who have only ever used the one product. Sure, you'll know it like nobody else, but that won't help you when you're treated like you've been boxed up as a Fortran who cant move on to working with C#.

If you want to be able to move jobs easily and keep your options open, you need to broaden your experience. Work on many different projects in many different languages, and preferably on at least 2 or more platforms, and keep yourself marketable for more than just being what you are today.

Of course, there are lots of other reasons to learn a new language, sometimes even just for the hell of it. It opens your mind to other possibilities, so when your boss comes up to you and says "can we do something", you can say Yes with a choice of tools available to you.

S.Robins
  • 11,385
  • 2
  • 36
  • 52
8

At this point in your career, you should learn new languages if you think they will make you a better programmer.

Most of your listed languages (Java/C/C++/Javascript/Objective-C) are conventional OO/imperative. Learning yet another OO/imperative language will probably not teach you much more about that kind of programming. Unless you have a particular interest, there is no point in learning the flavor-of-the-month on spec.

I am also inclined to be skeptical about claims to order-of-magnitude productivity increases. However, it might be worthwhile to check out the occasional reputed high-productivity language, to see if you like it.

The best reason to learn a new language is to learn skills of general applicability. For that, I would recommend a deep dive into a functional language (Haskell, or one of the Lisps) on one hand, and assembly code and systems architecture (x86 or ARM) on the other.

Functional programming will break your brain and improve your mind, while learning machine architecture will improve your debugging and optimization abilities, even if you never write another line of assembly.

comingstorm
  • 2,727
  • 1
  • 13
  • 14
6

Each one of us decides on what we want to work on so...

  1. you learn it because you want to
  2. you learn it because you need it for the job that you want

If you don't want to learn PHP, no one is making you and there's a ton of areas where you can program without ever knowing even how to spell PHP.

A lot of people look at the job market to see where hot areas area and jump on those technologies. A lot of people learn one language and stick with it and 20 years later they become legacy maintenance engineers. And then you have a lot of people who are anywhere between these two extremes.

In the end, it is all about what where you want to be.

DXM
  • 19,932
  • 4
  • 55
  • 85
  • In your description, it sounds a bit too black-and-white. "Technology hoppers" and legacy maintenance engineers are the two extremes IMHO, with most of us sitting somewhere in between. Also, some "technology hoppers" are too crazy about the latest shiny stuff to actually learn any technology properly (which would take more time than what they are willing to invest in any single tech), so they may never produce solid, long term solutions to problems. – Péter Török Feb 21 '12 at 17:46
  • 1
    @PéterTörök: Edited my answer. I was pointing out the scale, but was too lazy to spell all out. You are right, it is a continuous spectrum. – DXM Feb 21 '12 at 18:28
5

The best argument I know is that it broadens your perspective on how many different ways a problem can be solved, or some logic can be expressed. Knowing well Java and C++ gives you a good view on both the native & VM realms, but there are much more "degrees of freedom" to explore.

I have about 15 years of experience in C++, 5 in Java. There are many languages I learned and left behind (PHP, Pascal, assembly for a bunch of different processors, among others) and can say for sure that even those I don't use anymore left a significant mark on how I think about a problem. Also: even if you want to stick with, say, Java, for a given project, you'll have to know the alternative to present good counterarguments to its proponents.

Still, I learned Python just this year, and was delighted by how elegantly some things can be done. So much that I decided to convert a handful of REST servlets I had written, from Java to Python. The advantages in code maintainability were quite significant. For sure it left a mark on my way of doing things, too, not only because I will now choose Python for some tasks, but also because I may adopt similar design principles when coding in C++ & Java.

That said, I don't think you should learn lots of different languages all the time, just for the sake of it. It takes a considerable time toll, and the "accomodations" you'll have to make in your mind for them to coexist with the others you already know also take time and effort. I only decide to learn a language when it has enough maturity, has a good developer base, and offers significantly different outcomes from the others I know or plan to learn. When I decided to learn Python, for instance, I also considered Ruby and Perl, and later discarded them - at least for the near future.

Fabio Ceconello
  • 831
  • 6
  • 7
5

People learn new languages to...

  • expand their knowledge. If you know more you feel better and you're more confident.
    Confidence = Awesome Code!
  • have a bigger toolbox. Let's say you have to make an app. If you only know Java, you're going to make the program in Java. But if you know Java, Python, Scheme, and Lisp, chances are you're going to pick the best tool for the job.
  • get a job. Face it. If you know more languages, you have more job opportunities. That's pretty self-explanatory.
  • become a better all-around programmer. If you know the syntax of Perl, you know it can get a bit crazy. When writing long programs in Perl, you're basically forced to follow best practices, or you will not be a happy camper. Since you know Perl best-practices, this might help you write better PHP code (in one way or another).

So as you can see there are many reasons to learn a new language. My advice to you (and my only original quote that I think is good):

Write code frequently; Write code well; Write code in Scheme, PHP, Java, Python, Lisp, Perl, C, C++, C#, Visual Basic, Ruby...

Dynamic
  • 5,746
  • 9
  • 45
  • 73
5

I agree with most of the answers posted already. To append to these, check out the stats taken by the 2011 Stack Overflow User Survey. There was a very high correlation between number of languages known and money earned. They may not be directly tied to one another, but it is something to think about.

People who tend to learn more languages tend to make more money.

http://blog.stackoverflow.com/2012/02/survey-results/

hspain
  • 111
  • 4
4

Alfred North Whitehead wrote a great essay called "The Importance of Good Notation"

It is interesting to note how important for the development of science a modest-looking symbol may be. It may stand for the emphatic presentation of an idea, often a very subtle idea, and by its existence make it easy to exhibit the relation of this idea to all the complex trains of ideas in which it occurs.

A programming language is a form of notation. I can code OO in C; in fact that's how Stroustrup started with C++--as a series of C precompiler macros. However, it is far easier and quicker to write OO code in either Java, C++ or C# because they have language primitives present which support OO more easily.

All the reasons for learning new languages given so far are valid but I think the best reason to learn a new language is that a new notation may enable you to think in a new way which may help you to solve new problems.

Onorio Catenacci
  • 2,937
  • 3
  • 26
  • 37
2

Most or all of the answers above are related to the profession. Programming. I want to remind that before we are programmers - we are human beings.

One good reason why not learning a new programming language, in your case, is to let your self rest or do other things beside programming.

From my experience, working in agriculture and working with wood, thought me a lot about programming - more then learning a new language. i.e. To be a good programmer you should first be a good human being. If you don't have much experience in life, beside programming, your idea about programming might be totally wrong - even if you are an expert.

Many concepts in programming are coming directly from the daily life: simplicity, maintainable, practical, useful, fast - and sometimes slow, modularity, etc; are all concepts which are used by a carpenter, for example.

Believe it or not: personally I've learned much about programming concepts, by taking a long vacation for picking oranges. The main concept I've learned from it was - simplicity. From working as a builder I've learned another concept: build the base as good as possible - if you want the walls to stand straight.

Finally, the answer for your question might be: take a vacation, join a taekwondo class, or take care of the garden - then your question may not bother you anymore.

Martijn Pieters
  • 14,499
  • 10
  • 57
  • 58
Shian
  • 1
  • 1
  • While I could agree with you, I would add that after having all these good ideas about programming while doing other activities, I would want to learn a programming language in which these ideas are implemented. So IMO the two aspects (taking a break from programming and learning new programming languages) do not (should not) exclude each other. – Giorgio Feb 25 '13 at 10:11
  • It's true that taking a break from programming and learning new programming languages do not (should not) exclude each other. Yet, in the very fast world that we are living in, it is important to remember that rest - can be more productive then movement. It may be a coffee break - or even 1 year break. – Shian Feb 25 '13 at 13:23
-2

The value of learning a new programming language is, roughly, the reciprocal of the number of programming languages you already know.

This is because there are a finite number of paradigms and learning a new language will usually introduce you to at least one or two, making you more experienced and capable as a programmer. Some may turn your programming world upside-down. But when you learn a new language which features paradigms you already know, you already know them and you're used to them.

David Kendal
  • 165
  • 7
-3

As most of them written already, I have good working knowledge on C. Recently, I was working on some problem for which I needed to cross check the results; it was mathematical. So what is the fastest way to get the answer gave me a kick to check around faster programming language to be learned.

And I found out that bc, an arbitrary precision calculator language, the utility almost available on every Unix platform.

I didn't think of Python, Perl or anything, but I found out this solved my problems in a snap. I checked it out on the factorial(20000) that one of the friend suggested, and it gave results in a snap without any crash.

It is important only to a certain point that you need to know a new language which will ease your job/problem at present.

Definitely, if I write this in my resume I guess nobody cares, but from my perspective it solves my problem before I attack it in my favorite language, 'C'.

And also if there is a need to learn a new language you will get the opportunity with different problems and n number of solutions.

Peter Mortensen
  • 1,050
  • 2
  • 12
  • 14
czar x
  • 101
  • 2
-8

Anyone can create a new language; but nobody seems to understand that "better" is rarely the same as "so much better that the cost of adoption is actually justified". The end result is hundreds of different languages, where it's impossible for anyone to understand all source code, and where programmers need to waste about a quarter of their time being unproductive due to language/framework/library differences.

In an ideal world, there'd be one low level programming language (e.g. C), one high level "safe" programming language (e.g. Java) and one scripting language. There'd also be a large sledge hammer for destroying the "Programming Language Tower of Babel" created by people who don't understand the virtues of standardisation and the cost of "churn" and constant retraining on the I.T. industry as a whole.

From a 'macro-economic' sense, there's nothing wrong with learning a new programming language as a hobby, but using that new programming language for anything makes you part of the problem.

Brendan
  • 3,895
  • 21
  • 21
  • 4
    Sounds like a pretty impractical ideal. Who would decide these standard languages, and how do you decide that a new language is worth changing to? What about the risk of getting stuck in a crappy language just because no one is willing to try anything new? Imagine if we had done this 10 years ago -- Everyone gets to use C++ and Java (or maybe VB)! – Brendan Long Feb 21 '12 at 18:48
  • 3
    Your concept of "ideal world" sounds suspiciously like that of [*Nineteen Eighty-Four*](http://en.wikipedia.org/wiki/Nineteen_Eighty-Four). In your Newspeak, revolutionary ideas like "functional programming" and "type inference" and "first-class polymorphism" and "multimethods" couldn't even be thought, because there'd be no way to express them. Admittedly, Orwell doesn't seem to have thought of your sledgehammer idea, but if he had, I'm sure it'd have found its way in. – ruakh Feb 21 '12 at 19:05
  • 2
    In addition to the points above, very little of your "answer" is relevant to the actual question. Downvote. – user16764 Feb 21 '12 at 21:01
  • 3
    In an ideal world, there would only be one answer to Nupal's question. Having all of these additional answers after the first one by people who don't understand the virtues of standardization just causes confusion. There's nothing wrong with disagreeing with the answer in your own mind, but posting an additional answer makes you part of the problem. – benzado Feb 21 '12 at 21:02
  • 1
    Restricting to those languages wouldn't prevent any of the problems you mentioned. I had to rewrite application many more times due to changing frameworks than changing languages. – Fabio Ceconello Feb 21 '12 at 22:23
  • @BrendanLong: There's a "feedback loop" - companies tend to use languages that people know, people know languages they're taught at uni, and universities tend to teach languages that companies use. Universities would only need to take a more active role in the loop ("teach what companies should be using") but in my experience universities only take a passive role ("teach what companies already use"). – Brendan Feb 22 '12 at 03:56
  • @user16764: For people to make an informed decision they first need to be informed. All of the other answers highlight the advantages of learning new languages and therefore (on their own) don't paint a complete picture. My answer (the only answer that attempts to highlight disadvantages) makes the "sum of all answers" more complete. If all the other answers were against learning new languages I would've posted an answer advocating learning new languages. If you can't see this then perhaps your downvote reflects more on you than me. – Brendan Feb 22 '12 at 04:08
  • 1
    @Brendan - I downvoted you because your ideas of an "ideal world" is a totalitarian one. You are a successor in spirit of socialists like Bebel, who advocated for example to forbid private coooking, because it was "more efficient" to have a single communal kitchen and dining room. – Ingo Feb 22 '12 at 10:22
  • @Brendan Your excuse makes me wish I can downvote you again. You should be basing your answers on what you think the best answer is, *not* a desire post an answer that's different from the other ones. – user16764 Feb 22 '12 at 19:25
  • @Brendan: In an ideal world there would only be one language in which we would have written some AI software that writes the rest of the software for us. – Giorgio Feb 25 '13 at 16:21