Ask HN: How long does it take you to learn a new language?
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?
55 comments
[ 4.3 ms ] story [ 99.8 ms ] threadTo 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
Fluency? Months. Its usually not just the language but the whole ecosystem you need to learn.
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 '.
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.
In general, though, the more languages you learn the more likely it is that the next one you try to pick up is easier.
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.
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?"
* 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.
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).
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.
C# has built-in facilities to call C++ code in a managed sense. C# doesn't do pointers the same way C does, so all of the low level minutae to pull that off is a very powerful feature.
There are even some microcontrollers whose architecture doesnt support function pointers very well, ao just doing vanilla C stuff is essentially hardware limited.
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.
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.
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.
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.
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?
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.
I think you are the one being incredibly uncharitable. Here is the question:
"how long do you find it takes you to learn"
This is his answer for how long it takes him to feel he has adequate mastery. Perhaps he should have refrained from using the word "you" a few times, but it is not common in English to say "one," so you is often used to mean "people generally" rather than "You in specific, the person I am currently addressing."
It often causes problems in online communication and I have had my head handed to me over using the generic you on quite a few occasions, which is an incredibly uncharitable reading that usually gives me the impression the person was basically looking for an excuse to attack me personally for some reason. (This was years ago on a list where that kind of nonsense was quite common. I don't specifically recall it happening to me on HN, in part because I have worked at avoiding the generic you in any instance where someone might use it as an excuse to rake me over the coals).
You can spend the rest of the day wondering (privately, to yourself) if he is merely neurotic or if he has some kind of learning disability or if he has wisdom of experience that perhaps others should learn from (or all of the above -- none of them precludes the others). But that's completely different from assuming his answer is being given in bad faith.
There are other answers here that say some variation of the same thing -- that real mastery takes quite a long time. I don't see any reason why this answer should be singled out for being criticized in this way -- other than the fact that jacquesm is very high on the leaderboard and this position makes him a target of gratuitous nonsense of this sort.
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.
2 months sounds insane. I guess you did not click with Perl?
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.
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.
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.