

Ask HN: How do experienced programmers learn new languages? - mercsilv

I imagine this is different once you have a few languages under your belt - so I ask you, how do you go about this?
======
ryderm
Many languages have a few "killer" features/libs/uses. I often start with a
project that uses one of them. Eg:

ruby => rails

python => nltk,django,opencv,scipy

c++ => opengl,opencv

java => opencv

js => node,angular,ember

clojure => overtone

That way you learn the language and some specific good use cases of it.

------
nareshv
This was taught to me in college a decade.

"Programming language is just a syntax, the core logic of getting things done
is already available in your brain."

Here is what i'd do

A) Remember what you already learnt from your favorite language

    
    
      1] Syntax
    
      2] Libraries
    
      3] Reference Documentation
    
      4] Organizing your code
    
      5] Building / Running Programs
    
      6] Deploying code to farms of servers (if you are interested in sysops, explore this as well)
    

B) Once you get a hang of basic syntax, start with Examples and keep making
progress.

C) Pick a simple task, from what you have already solved before. Program it in
the new language by expanding your skills towards 2-5 points and you are done
!

~~~
dkersten
_" Programming language is just a syntax, the core logic of getting things
done is already available in your brain."_

Is this actually true, though, when jumping between programming paradigms?

~~~
amirouche
My only experience learning a new language that use a completly different
paradigm is Prolog. The syntax and builtins make it hard to write something
else that what it is meant for.

Do you mean learning or mastering a language. It is kind of different. Looking
for "ideomatic python" will help getting pythonic Python code done.

Not going against the spirit of the language helps.

~~~
dkersten
Well, even just _using_ a language (without mastering it) can be a lot more
difficult than simply learning the syntax.

For example, many years ago, before I really _got_ functional programming, I
tried to learn ML and while I figured the syntax out very quickly, solving
problems in a functional style was a lot more difficult and I found it hard to
use the language. Learning to use Python or Ruby or Java or C#, albeit not
idiomatically, is a hell of a lot easier.

Of course, _knowing_ a language is a lot more than just learning enough to use
it, though you certainly don't have to master a language to know it (and many
people will never completely master their languages, despite knowing them
quite well and using them effectively - for example, I'd wager few people have
truly mastered C++).

------
jmspring
I think it depends on how different the new language is. If you have a basis
in C-style languages, it is often not to hard to move between them
syntactically. Nuances might take a bit more time -- for instance, going from
C/Java to C#, lambdas, LINQ, and other commonly used components took a bit of
time.

When I first took a gander at Erlang, I poked at it, got a bit bored because
reading the language wasn't a bit harder. I took some time off, revisited a
couple of books and looked at some code and it made more sense.

But, overwhelmingly the way to learn is to find a small project that you are
interested in implementing and star there.

There really are two parts to learning a language -- the syntax and the
ecosystem/standard libraries. Often, becoming accustomed to the syntax is the
easy part, understanding the ecosystem can take more time.

~~~
kastnerkyle
I agree 100%. One of my favorite ways to learn a new language is by doing
problems from [https://projecteuler.net](https://projecteuler.net) . The
mathematical basis of Project Euler seems to map into core language concepts
better than many other "getting started" exercises.

------
htk
I don't know about other people, but the only way I really learn a new
language is by dedicating myself to build a project using it, no matter the
size, but it has to be something that you have a clear vision of what you want
to build (so you struggle at the hard parts, instead of just changing the
course of the project). This will make you search for ways to "say" what you
need in that language. It's analogous to going to another country to learn a
foreign language.

------
glimcat
I fiddle with some tutorials, get frustrated with readability / pacing /
coverage of core concepts, then knock out a project or three with the help of
Google, StackOverflow, and the docs for the language and any libraries that
seemed relevant at the time.

Across, I don't know, 20-25 languages at this point? Although I only actively
use 3-5, depending on how you want to define actively.

------
codeonfire
Read through the documentation. Write some simple code to learn toolbox idioms
and patterns. Read through the docs again. Look at some simple code. Build
something non-trivial. Then read through the docs again and you're ready to
go.

Learning something new in your field of study is not different, it is just
easier because you have some context.

------
matt_s
If you have a background with a Computer Science degree, it makes it easier.
One of the later courses in the program I had was assembly programming.
Everyone said this was the class that weeded out people. I found it easy
because there were only so many ways to do things and you really begin to
understand how computers work at the lowest software level possible.

Once you have a basis of data structures, object-oriented programming, and an
understanding of libraries in one area (say web programming with Java
Servlets) then learning another language is just a matter of building
something and reading the API docs as you go.

Try re-writing something not trivial but not overly huge to learn the
differences between old and new. After a while they all look the same,
regardless of how trendy or hip something might be.

------
LarryMade2
There probably is something you have done lots of times, mildy complex, but
you know how to write it in the languages you have done before. With the new
language you take that example and try to see how it would apply to the new
language. You know what you want to do and what to expect for output so most
of your brain is occupied by implementing in in the new language.

I've read folks who have some game such as tetris or some other as an example.

Also since I know various language commands and methods, I'll read through the
language reference from ! to z and see how it compares to what I know and
probably take notes along the way.

------
tokipin
Do one or two tutorials, then jump straight into a moderately-sized project.
Google profusely but also don't be afraid of hitting the language's manual.

Perhaps most important is to not settle for code that you know is not ideal.
If you recognize that a piece of code you've written isn't good, then improve
it. If it's still not idea, improve it again. Keep iterating on it. This will
necessarily involve focused learning. In fact I think this is the key to
picking up a language quickly. But it does require that you not be mentally
lazy.

------
codr
Think of something you want to write in that language; this is the only thing
that really works for me.

Tutorials and canned examples are ok, but if it's not something I actually
want then I'm not really learning much.

And if you can't do anything useful in the language you want to learn, then
ask yourself why you want to learn it?

Or take something relatively simple, and code it in whatever language. I did
this a while back, and wrote a port scanner in c, java, perl, and python.

------
kayman
I keep a list of side project i want to build. When i begin a new project and
the new language/technology i think might be a fit, i'll build something in
it. THis forces me to think outside the usual hello world tutorial and
building another to do list. And the problems I face to build my custom
project forces me to think and get into what i'm learning

------
coreymgilmore
Do a tutorial or two, then just start messing around and building. I find that
if I try to build something useful, I end up learning the code step by step as
I understand how it works and the features that are available

------
amirouche
this a starting point:
[http://learnxinyminutes.com/](http://learnxinyminutes.com/)

might help:
[http://rosettacode.org/wiki/Rosetta_Code](http://rosettacode.org/wiki/Rosetta_Code)

reading about the language or read code. Writing code...

------
coledubz
I was once told that the best way to cement your knowledge of a new language
is to build a chess game in it.

