
Ask HN: How long does it take you to learn a new language? - isthispermanent
Assuming you write software full-time and know at least two languages fluently, how long do you find it takes you to learn a complete different language to a level where you can start contributing to a project with it?
======
mindcrime
I've been programming 25+ years and I wouldn't say I truly "know" a single
language yet.

But to answer the question... to get to a place where I can contribute
meaningfully to a project? Depends on the language, but I was dropped into a
PHP / Python shop once after doing nothing but Java and C++ for the preceding
10 years or so, and I was contributing both PHP and Python code in a few days.
But if you were to drop me into a Haskell or CL shop, I have a feeling it
would take a bit longer.

~~~
marcus_holmes
same. Been coding since I was 11 years old. Still learning.

Not sure I can actually point to a single language that I have mastered
(except maybe Visual Basic).

I enjoy several language now, but often can't remember syntax for any of them.
I think that's the thing that fades as you learn multiple languages - syntax.
I know when I should use a loop, I struggle to remember how to implement a
loop.

~~~
flyingcircus3
It is nearly frightening to go from being super proud of something you thought
was your best work on some project, and then just being away from it, six
months later, come back and say "who the hell wrote this crap", before
realizing that you, in fact, wrote it.

But that's the comfort that comes with the experience. I can afford to forget
individual moments in time, because I know I can spin back up very quickly, if
need be. It just has its comically absurd moments at the very beginning of the
spinning.

I've learned to stop quantifying my learning as the "gotta get it all"
mentality, because "what do I need to learn to solve today's problems" has a
pretty good streak going.

------
JamesBarney
The majority of the time is not learning the language, it's the learning the
framework. So it really depends on what's you're doing.

Things that make it take longer.

UI heavy tasks

Anything that requires heavy customization of large framework.

New projects.

Usually in a month I can come up to speed where I'm contributing to an
existing project, without doing any heavy framework customization. 6 months
until I feel like I can handle pretty much any task, just need a little more
time than an expert. And after a year I can probably do most things quickly.

------
outside2344
Contributing? Very little time. I recently did this with go and was able to
contribute patch level changes in a couple of days.

Fluency? Months. Its usually not just the language but the whole ecosystem you
need to learn.

~~~
aidos
Agreed. When I started to do python full time I had already been coding
professionally (in different languages) for about 15 years. I’d say it took a
good 6 months before my code looked nice and pythonic. Sure, it worked from
the start but I was reading lots of other code and mine just didn’t feel right
in comparison.

------
jacquesm
A couple of decades, perhaps. And even then if I do not practice them
regularly they fade, much like real languages.

It takes me much less effort to get back in after that compared to the first
time but there usually is some start-up effort required.

Programming you never forget, but the nitty gritty details of language and
library implementations are so hard to remember because each language insists
on doing their own thing just subtly different from the rest. Languages that
are totally alien to the mainstream are much easier in this respect.

But even after decades in some languages I would probably look like a total
newbie the first couple of days having to look up commonly used function
parameter orderings or record members.

~~~
platz
This kind of response is on the more uncharitable side of the responding to
OP's intention.

If it takes 'decades', you might as well give up now, if you're considering a
job opportunity that uses a different language than the one you're used to.

"A lifetime" is not a helpful response in what an honest question like this,
because usually everyone realizes that full mastery on the level of compiler
implementer is not what is implied by such a question .

Did you miss the part "to a level where you can start contributing to a
project with it?" In OPs question?

Is that really decades?

~~~
jacquesm
If you grow with an eco-system from the day that it starts to be marketed
publicly to where it is today you have seen all the good, bad and ugly that
came with it and you deeply understand why things are done the way they are
done. If you are dropped into an already existing eco-system (say Java) it
will take you a very long time to catch up with what for old hands is
'obvious'. Maybe I'm a slow learner, maybe I lack confidence, but for me
before I'm ready to go and 'show my work' it takes a long time.

Even now people are asking me almost on a daily basis to post a bunch of
python code that I wrote and I'm probably not going to do it even though I
fully intended to because - to me - it looks like crap, and I lack the time to
make it better.

A couple of extra notes: I'm 'old school', never found an IDE that I liked and
tend to memorize everything. This takes a long time. A typical library is a
couple of tens to 100's of functions and getting to know such a library (or
API, for that matter) takes time as well. Which makes me totally unsuited for
certain kinds of programming, the kind where the eco-system moves faster than
I can keep up with it.

~~~
Baeocystin
Never let the perfect be the enemy of the good. If your code runs well enough
to solve a problem and be useful, it's good enough to share.

------
seanmcdirmid
Most languages are fairly easy to be productive with in a day and master in a
few weeks if you already have lots of experience. Some languages are more
complicated than others, and the domains they are used for might require a lot
more work to learn and master if you are unfamiliar with them.

A language like Haskell or Rust might take much longer to master depending on
where you are coming from.

When I was an undergrad, we had a "language of the week"-style PL class. It
seemed like an easy 4.0 given the languages they covered (mid-90s, so it was
Smalltalk, Prolog, Lisp, SML, and a few more I can't recall).

------
platz
Entirerely depends how different/unfamiliar the language is from the languages
you already know. Paradigm shifts are harder.

~~~
droidist2
Exactly. Coming from say Java, Python is pretty easy, JavaScript is a bit
harder, Lisp/Clojure is even harder, Haskell is a lot harder.

------
jcoffland
If the language does not include drastically new concepts it takes me a couple
of days to get the syntax down well enough to be productive.

I'm always suspect of people who measure programming skill by the number of
languages you/they know. This tells me that they find it hard to pick up new
languages and therefore don't really understand the concepts that underlie all
programming languages.

When I started programming as a teenager, 25+ years ago, I learned assembly,
Pascal, Logo and C. In college I learned C++, Scheme and Java. Later I
designed and wrote a language of my own, xmlpl, and picked up other languages
like JavaScript, PHP and Python. I've played around with a lot of other
languages but haven't really used them in production code. There are _a lot_
of cool languages that don't have enough supporting tools and libraries to
make them really useful.

Here's how to pick up a new language:

1) Locate and learn to use the documentation and toolchain.

2) Learn and understand any new concepts the language depends on.

3) Learn 90% of the syntax well.

4) Use it to write something nontrivial that you are interested in.

Notice I did not mention anything about learning the libraries. There's little
value in memorizing something you can lookup quickly.

------
zinkem
I agree with others here that learning a language has a lot to do with
learning an ecosystem, libraries, and culture. To contribute to an existing
project, it's not necessary to really know the language that intimately. I
"know" a handful of languages, but I have contributed in environments that I
don't "know."

To learn languages quickly, I think the best way is by learning the 'building
blocks' languages are composed from. How are function arguments passed (value
vs reference), how is memory management handled (garbage collected, reference
counted, manual?). Learning these lower level language concepts then allows a
person to approach a new language by saying "How does this new language X
handle concept Y?"

------
blocked_again
It all depends upon the time you have. I was once in a position to fix an
issue in an open source project that used Django. I had very little knowledge
of Python and 0 experience in Django before. So I told myself this is not
rocket science and I am not going to give up until I figure this out and
started working on the issue. To my wonder, I was able to figure it out by
evening. So I would recommend you to get an issue to work and jump right into
the codebase. if you don't know which files to modify use the grep command. Go
through documentation, tutorials and all only when required. Remember this is
not rocket science. Learn as much as you can from the existing codebase.

~~~
salex89
I've been actively working with Django and Python for the last six months.
Before that I was using Python for utility stuff, scripts, automation etc. It
looked like a nice language earlier, now I think I will never get to learn it.

------
ufmace
It varies widely, depending on the language and the type of contributions. It
can be pretty quick for languages which are very similar, like between C# and
Java, or for languages which are easy to learn, like Go. Languages that
include a number of complex concepts not shared among other common languages,
like Haskell, may take much longer.

I think the scale of contribution is a much bigger differentiator though. At
one end is a trivial bug fix - tweaking a string, changing an option passed to
a method, something like that. I'd say usually under an hour for that, unless
the language is very difficult indeed. A little inspection of the code around
it plus programmer common sense and a few Google searches will usually tell
you what you need to know. Things get harder the bigger the change you're
trying to make though. If you're doing major adjustments or new functionality,
you'll need to know the best practices for how to do things in that language,
how the rest of the application is architected, etc. You may need to learn the
languages standard library, if it has one, and if not, what are the best
third-party libs for doing various specific things and how to bring them into
the project. This could easily take weeks or months.

I suppose the ultimate level of contribution would be making significant
changes to the language itself, its standard lib, or to any large, mainstream
libraries used in that language. There, you also need to understand the
overall purpose and mindset of the language and have a broad view of the
ecosystem of how it's used and who is using it. That can take years, maybe
decades.

------
grayrest
There's a couple different stages and you can stop at pretty much any point:
being able to read it, understanding all the ideas, writing with correct
idioms, writing fluently, being able to design projects/systems effectively in
it, and finally coding stability.

I know a lot of languages and learning new ones gets easier as you learn more
of them. I can read pretty much anything aside from some APL variants. It
usually takes me 2-3 hours to get the ideas for most. I can usually get to
writing reasonably good code over a weekend and that's usually enough to fix
bugs or contribute code following someone else's design patterns but it's
fairly slow going. From there things slow down a lot because you need to work
your way through the ecosystem learning the common libraries and their
interfaces so it's usually 2-3 weeks full time before I really feel fluent and
6-8 weeks full time before I'd be confident in adopting it professionally. I
find that my coding style stabilizes (I look at code I wrote 6 months ago and
would still write it that same way) in a language after about a year and a
half.

This timing varies a lot depending on the language. Languages that are
designed to be familiar to C#/Java/JS devs like Dart or Go and you fall in
that camp, you can blast through the tutorial to get the syntax and be into
learning idioms. If you're significantly shifting paradigms (e.g. picking up
your first functional, logic, or concatenative language) then you can expect
to spend a couple weeks being blocked in the ideas phase. Switching domains is
similar so if Rust is your first systems level langauge, you're going to spend
a LOT of time on OS and memory details that other languages handle for you.

------
veddox
"Completely different" is a difficult concept when comparing languages... Not
only because similarity is a gradient, not a category; but also because most
major languages today are in some way or another descended from C.

So the answer to your question will probably hinge largely on the degree of
similarity between your known languages and the one you wish to learn. To give
a personal example: I currently know Java, Python, Common Lisp and R, in the
sense that I have written non-trivial code in these. Last year, I tried to
teach myself Haskell, and failed miserably. It was a very different syntax to
everything else I knew and had several concepts that were quite alien to me.
(It didn't help either that I didn't strictly _need_ to learn it, and didn't
have much spare time on my hands...) This year I am having to learn Julia for
a project I joined, and I am finding it much easier. Although it isn't quite
like any of the other languages I know, its syntax is close enough and I am
already acquainted with its concepts. The result was that two weeks after my
first exposure, I was ready to contribute code.

------
Jemaclus
Background: I've been writing code for about 25 years, and I consider myself
to be pretty good at what I do.

Depending on the language, I'd say a couple of weeks of full-time work. I tend
to dabble with new languages, so the calendar time is on the order of months.
That said, I've started a few jobs where I had to learn a new language trial-
by-fire style, and I was productive and able to contribute to projects
actively within days/weeks.

The thing is that _most_ programming is similar, regardless of language. You
still have arrays and tries and dicts and functions. The patterns are largely
the same. There are, of course, different families of languages where some
patterns are more similar than in other languages, but for the most part, when
I pick up a new language, I'm really learning more about syntax and structure
than anything else.

For example, Go took me about 2 weeks to become really productive in it.
Elixir, on the other hand, has taken me a lot longer (partially because I
dislike Ruby -- especially Rails -- and therefore the syntax is fairly alien
to me).

Hope that helped.

------
Raed667
Usually if it's just another object oriented language I'll be able to get a
simple patch going in a day or so. However learning the language could take a
couple of months at best for me to be able to add it on my CV.

The thing I find challenging when learning while in a project, is that it's
hard to separate then ecosystem, the framework and the language '.

------
nv-vn
Different times for every language. Some I've been able to pick up in a matter
of days or even hours (being able to read and write Dart code, for example,
was very easy because I already knew Java, C#, JavaScript). Others take a few
weeks to feel comfortable (learning OCaml for the first time or getting
started with Prolog). Finally, there's a category of languages that take
forever to be able to use (namely, Haskell). But each language becomes
exponentially easier the more similar languages you know. Learning Haskell
after knowing Idris felt like nothing, and switching from Java to C# was a
piece of cake. The best way to learn languages quickly is to just keep
learning new things. Even apart from learning new abstractions for each
language and being able to reuse them, you end up training yourself to think
in a more abstract way with more possibilities to work with.

------
digsmahler
Two weeks. I refer to it as the cussing period because it's full of situations
where I know something is possible and easy, but I have to figure out how to
find the right documentation and put together the peculiarities of the new
language in my mind. Usually that feeling of frustrated helplessness goes away
after two weeks.

------
scarface74
Learning a C like language - about two weeks. That is my recent experience
with Python.

The part that takes awhile is not the language it's the framework. I would say
6 months to a year.

------
bufferoverflow
Depends on what you mean by "know". I was able program in Python without ever
learning it (not by choice), I had to look up a few things, but my code worked
in the end.

To actually fully know _any_ language and all its quirks is tough. Look at
Ecmascript specification, it's quite long. And that doesn't cover all the
undefined behaviors.

[https://www.ecma-international.org/ecma-262/8.0/index.html](https://www.ecma-
international.org/ecma-262/8.0/index.html)

------
ulisesrmzroche
Contributing to a project probably on the first week: As in after code-review
it will get merged and pushed to production.

The problem is you're going to be slow until you get comfortable with the
language, so it does take its toll on development speed. It's also harder to
estimate and schedule since you have to take your own learning into account.

I find that it takes me a couple months to feel comfortable if I like the
language (Golang) but with ones I don't (PHP) it always feels like a slog. To
each their own here though.

------
quaunaut
It's a bit of a matrix for me.

* Dynamic-type languages usually only take 2-3 days to start contributing, sometimes I'll even have a new PR in on day 1. * Static-type languages honestly take me awhile, usually around 1-2 weeks to start contributing. * To feel actually competent, it usually takes a week in dynamic, closer to 2 months in static for me. * Also, there's "weird" languages, like Erlang/Elixir/Rust/etc, which have their own learning curve. It just adjusts upward by different amounts.

------
dbranes
Not an answer but a general comment on learning languages: instead of setting
your goal as “to learn as much of a languageas possible”, instead you can go
for “I want to be able to do this class of things that will be made very easy
once i know thia language”.

If you do the former it’s very easy to learn something then forget it.
Furthermore, echoing other comments, you would lack clear measures of success
because it almost makes no sense to ask whether you truly “know” a language.

------
BurningFrog
I've done this a few times, and I can start contributing quite soon. Like the
first week. It just takes _much_ longer.

I know enough "software engineering" that I know pretty well _what_ I want my
code to do. So I just need to figure out how to express that in this new
language.

Right now, I've been doing Python for 3-4 months and am starting to feel quite
comfortable. Then again I'm far from an expert and would not do well at a
Python centric interview.

------
jmcgough
Contributing? Within a week, though slowly at first with a lot of comments on
my PRs.

It'll take ~3 months to hit my full stride and mostly understand the correct
"way" to write that program (its common patterns, how best to use some of its
features).

A deep ("expert") understanding of the language? Like 3 years, but varying
wildly depending on the projects I use it for, the feedback I get from others,
and the research and dedicated practice I put in.

------
jimpudar
On a massive Perl / Mojolicious project it took me about 2 months to
contribute, and 8-10 months to gain a moderate level of fluency. Like others
have mentioned, I don't think I will ever fully know the language.

On an extremely large Salesforce APEX project, it took me a few weeks to
contribute and a couple of months to gain fluency. APEX is pretty much a
subset of Java (with minor differences) so there was a lot less to learn
there.

~~~
vgy7ujm
Took me a couple of days to grasp Mojolicious as a Perl programmer. Really
well thought out framework.

2 months sounds insane. I guess you did not click with Perl?

~~~
jimpudar
The application uses Mojolicious magic very heavily and we have a lot of Perl
'wizards' who like to write code that relies on little known language
features. Now that I am very comfortable with Perl I enjoy reading that kind
of code, but coming from mostly Java/APEX it was a difficult experience.

------
eloff
I've programmed in over 20 languages, it typically takes a couple days to a
week to make a meaningful contribution to a project. The more languages you
know, the easier it gets because there are very few truly novel things in
programming languages - just different syntax for doing the same.

To achieve mastery in a language takes years of steady use, a constant
attention to learning best practices, and good code reviewers.

------
khc
I learned go and wrote
[https://github.com/kahing/goofys](https://github.com/kahing/goofys) in a
month, and learned rust and wrote
[https://github.com/kahing/catfs](https://github.com/kahing/catfs) in about
the same amount of time

------
stunt
It is not only language you have to learn. its ecosystem, environment,
libraries, frameworks, tools, testing, debugging, paradigms, and etc.

Since mastering a language takes years, I use 20hrs rule. I spend 20hrs on
reading, learning and practicing the language and environment itself and after
that I dive directly into the project.

(I've been programming 9+ years.)

------
astrodust
It really depends on the language. Going from C# to Java and vice-versa is
pretty seamless, but moving from Java to C++ can be dizzying even if the two
have a lot of commonality.

In general, though, the more languages you learn the more likely it is that
the next one you try to pick up is easier.

~~~
scarface74
I posted earlier that it only takes me about two weeks to learn a "C-like
language". But I never thought that was only the case because I learned C and
then C++ _first_ and used them for about 80% of my development for 10 years.
If I had started out with C#, Java, or Python and then wanted to learn C or
C++ it would have taken me a lot longer.

------
Hamuko
There's not really a linear relationship between knowing about a language and
contributing to a project. I contributed to a C++ program after Googling
around a couple of hours without having written C++ ever before. Granted, it
was a small patch, but still.

------
rhacker
It's kinda like you're an American that just moved to another country. The
native people will know you're from America for a long time just by hearing
your voice. It will be in the subtle details. (Yes I'm talking about the
software side too)

------
amelius
It's one thing to learn a language, and another thing to "learn" the ecosystem
of libraries and be productive.

------
newusertoday
it depends, if you have experience with similar style of language than
learning syntax and starting to contribute is easy may be 1-2 days. However
"knowing" involves learning how it is implemented and how the tooling works
underneath. Which can easily take 2-3 years.

------
k__
Depends on how much the current maintainers are willing to do by themself, I
guess.

------
phanindra_veera
a day

------
87822487
HA HA, I thought you are talking about real language. Anyway, I have learnt to
read japanese in 20 days, in order to read novel in japanese. Today, I still
don't speak fluently since I didn't particularly interest anything other than
some reading.

It is pretty similar experience to learning a programming language. You can
cram yourself to be productive on a new language in a week. But to master a
language, you have to expose yourself into different situation when use the
language. You can be good at using python to write some machine learning code,
but how about a web application? How about writing qt? And also different size
of a similar project need dramatically different architecture.

English is not my first language, so it is pretty similar situation. I can
talk professionally as a software engineer. I can write a HN post that anyone
can understand (or maybe not). I can read news, article about technology etc.
But when I try to read literature such as novel, I found myself I don't have
enough set of vocabulary in this setting to comfortably read without
constantly checking dictionary. I cannot flirt a girl in English whose first
language is English. So, obviously I don't claim myself mastering in English
because I cannot use English effectively in all situation and social settings.
But who does anyway if it is a second language? Similar to programming
language, you just cannot master a language without knowing all or at least
most aspect of different application and pitfall on implementation. Even the
language inventor can't do that I believe.

So, the point taken is use a language to be productive enough on your setting
is enough as a goal. You can aim to adopt more different situation if you want
improvement. But perfect is the enemy of good.

