17

Possible Duplicate:
(Why) Should I learn a new programming language?

I came across a line in this article which is,

Learn one programming language every year

Why do good programmers suggest to learn more programming languages . We can be a jack of all and master of none too in this case.

6
  • 2
    Good question. While I'm not against learning new things all the time, I do wonder why people feel it's necessary to spread your knowledge over so many different specialties. And I don't think this question should be closed, even if it does ask for opinion.
    – Mr Lister
    Commented Oct 20, 2012 at 15:16
  • 1
    I think you're too focused on language mastery here, I never understood this advice to suggest mastering each language. I think it's a given programmers should have a language of focus they are spending there ten years to master, this advice merely suggests learning other languages for exposure and practicing different idioms. No need to delve deeply into a language for this in a way that hinders mastery of your primary language, rather it should bolster that mastery by teaching a new perspective on your main language. Commented Oct 20, 2012 at 17:46
  • 7
  • 5
    Did anyone honestly look at this question and not realize that it had been asked 58 times already? Be responsible, don't reward laziness, vote to close.
    – Aaronaught
    Commented Oct 21, 2012 at 0:50
  • 1
    Jack of all trades, master of none, but often times better than a master of one.
    – voithos
    Commented Oct 21, 2012 at 1:09

10 Answers 10

28

I have not read the article, but I have seen this specific piece of advice many times over, it is common knowledge.

The original piece of advice, does not refer to mastery that comes after years of experience, but to exposure on different paradigms that will provide the individual with different approaches on solving problems. So there is a footnote somewhere missing that would say: "Different programming paradigms".

A good but not so relevant post on how different approaches to programming affect problem solving is this post by Steve Yegge Notes from the Mystery Machine Bus.

7
  • Learning different paradigms per se isn't bad, but it's the new set of libraries one has to learn in order to become proficient. That's what my problem is. Why the need to dive into language X if the same problem can be solved just as easily with a language I already am familiar with?
    – Mr Lister
    Commented Oct 20, 2012 at 15:18
  • 1
    @MrLister The paradigm exposure is a compelling reason for me (for sufficiently different paradigms). But also consider that most languages don't have really good libraries for most tasks.
    – user7043
    Commented Oct 20, 2012 at 15:25
  • 6
    You might be confusing languages with their libraries. Decision on language design have implications that start with (yes) libraries available and go through the whole ecosystem. Also the more tools you have on your disposal the easier it is to tackle a task. Example: some things that I can do with Zsh take me five minutes, while if I tried to do them in Java, would take me hours (and vice versa) Commented Oct 20, 2012 at 15:25
  • Also added a nice post that explains such differences in my answer. Commented Oct 20, 2012 at 15:25
  • 1
    And each programming language comes with it's culture which makes a programmer better overall. It helps broaden your view of a problem and the possible solutions. I helps you think a little bit out of the box of a single language or culture. It's like learning different spoken languages, they help you learn the culture of the people using those languages, grammar is just a technical way to use the language. Libraries and statements are just the grammar of a programming language, the culture behind them is the real value. Commented Oct 20, 2012 at 15:41
30

Our trade is programming. Programming languages are tools of that trade. Learning multiple languages isn't being a "jack of all trades," it's being a master of the tools of one trade.

6
  • 1
    Precisely! Being really good at using a hammer does not make you a carpenter.
    – glenatron
    Commented Oct 20, 2012 at 21:14
  • 1
    Couldn't agree more. Someone who knows how to use hammers well will look at every problem as a nail ... Commented Oct 20, 2012 at 21:27
  • 5
    @glenatron, I'm not sure I agree with your analogy. A language is not a hammer or a screwdriver, it's a toolbox that contains various tools. Learning a new language is like buying a Stanley toolbox when you're used to a Crafstman toolbox. The different toolboxes will have several similar tools as well as some unique ones, and most if not all the tools will look and feel slightly different.
    – devuxer
    Commented Oct 20, 2012 at 21:59
  • @DanM that is different to my experience of learning different languages. There are similarities within language types ( for example Python and Ruby have a lot of common ground in approach and there wouldn't be much point in learning VB.Net if you knew C# ) but what different languages offer is much more distinct than slightly different tools for the same job.
    – glenatron
    Commented Oct 22, 2012 at 9:31
  • @glenatron, Agreed...I guess the toolbox analogy isn't quite right either :) In any case, I agree with Karl's answer.
    – devuxer
    Commented Oct 22, 2012 at 16:21
13
  1. Because life rarely lets you get by with a strategy as simple as "I will become an expert in X and ignore all other fields." It more difficult and more subtle than that. Developing an area of deep expertise is essential but you also have to keep your eye on developments outside your specialty. Over decades the industry inevitably changes. If you don't keep up with developments outside your specialty you can miss the appearance of superior tools, miss the rise of new markets, and end up stuck in a niche market. How you balance the time you spend on deepening your primary expertise vs. expanding your knowledge is a judgement call. In your first few years almost all of your time will be spent going deep, but as you mature you'll want to spend more time branching out.

  2. Not all languages are equally effective for all tasks. CGI is a pain to do in C, and you aren't going to be writing device drivers in JavaScript. The folk wisdom is "If all you have is a hammer, then all the world looks like a nail". Knowing multiple languages helps you make judgments about what the right tool for a job is.

  3. Learning other languages will help you understand your primary language. If you only know one language you'll have a host of unconscious assumptions that are actually design decisions. Learning multiple languages will help make you aware of you assumptions.

  4. Once you've learned three or four languages learning another one becomes pretty easy.

7

Why do good programmers suggest to learn more programming languages

There are a couple of different ways I could see this being quite useful:

  1. Getting different perspectives. If you've looked through a lot of procedural, OO, and functional code you can see very different ways to approach a problem and this can be useful to have many different tools in one's toolbox. The breadth can be useful since more often someone will want something fixed and doesn't care at all about what language is used. "Just get it done!" will be what the client or customer's focus yet there are likely multiple ways to implement a solution. How many do you naturally consider and how many others are out there? This is more about how to be open to what choices are available which can be more than a bit mind numbing to consider all of them. Thus, trying to make this bite size and just do one at a time can be quite useful.

  2. Preventing lock-in. By adding another language, there is a chance that there will be some new pieces that may require some adaptation. How do you handle things changing? By taking on a new language regularly, it can help prevent the perspective of thinking everything can be done in one language or with one framework. Technology changes often enough that the skill of how to pick something up from scratch is well worth having honed, and that is part of the benefit that comes from this practice. If someone just coded in C for 20 years and didn't touch other languages, it may be challenging to see how well this person would adjust to a language with a very different syntax and overall structure.

7

While I have yet to truly master any language, I've learned a few well, and I've used/dabbled in many. With each new language I pick up I get better at the others I know. Learning each new language teaches me to focus on core disciplines that work across them all. Thus learning new languages makes me better at software architecture, better at choosing and using data structures, I learn new things about my text editor/IDE, and I get better at communicating ideas in a less language-specific manner (to name only a few benefits.)

5

It helps to know more than language, you can more easily talk to more people. It is true with foreign languages, it is also true with programming languages.

First of all it's a good training for your brain. You learn new ways of doing the stuff you usually do. Sometimes you'll find that your common tasks are more easily done in a different programming language.

Second of all when your main programming language gets worn off, you will be able to switch to another one easily.

You will also be able to get along with 3rd party software developers. Knowing limitations and strengths of various different languages you will be able to predict what will be difficult to implement in a given language.

Also remember that programming skill is independent of a programming language. It's like knowing how to speak. If you know how to speak in one language, you just have to learn new vocabulary and new grammar to properly speak in another language. No need to learn how to use your tongue, vocal chords, teeth, etc.

4

From another answer, I've always thought "learn one programming language every year" was terrible advice for novice programmers for exactly the reason you state.

A novice programmer needs to learn far more than one language in short order:

  • A general purpose scripting language such as python or perl
  • A faster language, typically a compiled language, because python and perl are too slow
  • Some familiarity with the shell
  • Some familiarity with make

That's a minimum. Add Matlab or Mathematica for someone working in scientific programming. The simulation environment often is a language if you're working on simulations. For someone working on databases or games, that database or physics engine are in a sense languages of their own. A GUI adds yet another piece of complexity.

It's the novice programmer who faces the steepest learning curve. Learning a language a year is a piece of cake after having accomplished that initial step.

0
3

If learning a new language strikes you more as a task than a joy, you may have picked the wrong profession.

It's like a musician not wanting to learn a new instrument--they may prefer one and be better at it, but one who loves music should always be interested in exploring new options that might be provided by different instruments or styles.

Also, learning a new language may provide you insights into programming styles that you can apply to other languages. A language could teach you to write your code to be more readable or take advantage of various patterns... It's just part of being a programmer to be constantly learning.

3

Think like a chef. If you learn a new cooking technique, if you learn about a nice spice to add to your dish, or if you learn a new preparation for a given ingredient set, you expand your abilities. You can add some flare to your cooking abilities.

The same is true with programming. Some tools are better for some tasks than other, and different programming languages can help differentiate between how to solve problems in different ways. It helps to have diversity in how to solve problems.

2

I agree with dimitris mistriotis, but I can also mention that if you read a lot on the theoretical topic (such as OOP, functional programming, agile practices and many other...) you don't really need to know more languages than those you use. But it is a matter of personal opinion, I guess.