Ask HN: How long does it take you to learn a new language?

37 points by isthispermanent ↗ HN
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 ] thread
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

(comment deleted)
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.

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.
Entirerely depends how different/unfamiliar the language is from the languages you already know. Paradigm shifts are harder.
Exactly. Coming from say Java, Python is pretty easy, JavaScript is a bit harder, Lisp/Clojure is even harder, Haskell is a lot harder.
Depends on how much the current maintainers are willing to do by themself, I guess.
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 '.

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.

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.
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.

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.
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.

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?"

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.

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).

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.

I would echo the statement. May be more than languages programming paradigms take more time to learn .
At some point, that's the motivation to keep learning the Nth one. You don't know what you don't know, but when you stumble into a new paradigm, it suddenly creates this massive perspective shift that changes how you use all the languages you already have learned.
Is there really a different paradigm between learning one C like object oriented language and another?
Sure. Each language has its quirks, and bells and whistles. Starting with C, and then moving to Objective C, just the basic nomenclature and syntax makes you think of the architecture you're building in new ways.

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.

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.

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.

What do you consider knowing a language?
"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.

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)
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.

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?

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.

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.
Depends on the project. Yes, some take decades.
Did you miss the part "to a level where you can start contributing to a project with it?" In OPs question?

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.

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.
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.
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.
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.

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?

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.
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.

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.

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.