DEV Community

Marco Suárez
Marco Suárez

Posted on

How do you learn a new programming language?

Sign for a course maybe? Look for video tutorials on YouTube? Head-first into a book? Which one do you think is the best way?

I want to know your methodology, I'd be great if you pointed out your level of experience so we can maybe see if learning habits change with it.

Oldest comments (18)

Collapse
 
buntine profile image
Andrew Buntine

For me, the most effective approach to learning a new language has always been diving in and creating something. I typically write a program that solves a problem I know relatively well.

My GOTO programs are generally one of Conway's Game of Life, a Brainfuck interpreter or an EAN13 barcode encoder.

I generally read the docmentation of the language and keep a tab open on the API docs, also. If the language is a large paradigm shift from where I've been spending a lot of time I will probably start with much smaller programs and work my way up.

The general advice from me is to always write code. Don't simply do contrived tutorials that are only designed to demonstrate the major selling points of the language in question.

Collapse
 
13hoop profile image
yongSir

start

read Doc

do Some Demo

read Doc ...

do ...

Lied myself already learned

end

:)

Collapse
 
andy profile image
Andy Zhao (he/him)

Hahaha I hate to say this but this is pretty much me.

Collapse
 
arandilopez profile image
Arandi López

Same, I prefer to Lear docs and API... Build something and then add to the known languages

Collapse
 
bgadrian profile image
Adrian B.G.

I am an experienced developer, the process of learning a new language take less and less time, as more languages and paradigms you know, because you make associations, see the Polyglots.

I actually wrote how exactly am I learning Go, now. As you can see I "attacked" it on all fronts (watch tons of videos, read the manual, do a course, chat, write code every day).

Collapse
 
k4ml profile image
Kamal Mustafa

I wrote about this before - dev.to/k4ml/first-step-in-learning...

Collapse
 
nnao45 profile image
nnao45 • Edited

for {
write_code()
if !be_understanding {
read_doc()
google()
continue
}
}

Collapse
 
dwd profile image
Dave Cridland

I have to admit, I've not learned new languages recently - beyond some basic fiddling to alter an existing program. I look them over and get an idea of what I might want to learn them for eventually, and then sigh about not having the time.

But when I used to learn new ones more often, I'd first block out some time. I generally went for 24 hours - a bit arbitrary, but it worked.

Then I'd write a rough webserver. I'd make it handle HTML, images, and a CGI program - which probably dates this technique - and support HTTP/1.1 (which was a bit bleeding edge back then). In those days, there weren't, typically, library functions for HTTP, so this was written from first principles.

This got me a good feel for a few things:

1) Network handling. Often asycnhronous event-driven stuff, but sometimes I'd have to use forking or threading. Usually I'd pick whatever worked best in the language, sometimes I'd deliberately try a few approaches.

2) Text and binary data handling. Some languages I learned couldn't handle binary data very well - the Tcl webserver I wrote suffered from this badly, for example. Others handled text and binary data equivalently (C++, Python2).

3) Parsing. HTTP headers, being RFC 822, are a disaster to parse - which is why mail servers were written to avoid this. HTTP servers, however, can't avoid it. Folding is particularly fun.

4) IPC. That's Inter Process Communication. This is probably less useful now than it was, but handling external programs got me a good feel for how well the language and its environment exposed the platform functionality.

Whatever I needed to find out, I'd go hunting for on the Internet - but it meant I wasn't looking for "How to write Tcl", but "How do I XYZ in Tcl", which meant my research for more focused and goal-driven.

Looking back, while it provided pretty good coverage, it missed several aspects which are really quite interesting to me now, like data storage, for example. I don't know what project I'd pick now that would be any better, either - an XMPP server would be fun, but that's really quite a huge thing.

Collapse
 
soupwaylee profile image
Stefan Su (he/him) • Edited
  1. Go to the "well-known homepage of the language" and get an overview of the most important keywords via breadth-first-search.
  2. Start with YouTube tutorials. If there is live coding, I try to copy what happens in the videos and take small notes. Helps to see what set of tools are used and what the workflow looks like.
  3. Look up terms that were mentioned (but not elaborated on) in the official documentation and learn to navigate through it.
  4. Look at code that has been written before to acquire the flavour of the language. (Github, stackoverflow etc.)
  5. Apply in own projects / playgrounds and gain deeper understanding of important topics via depth-first-search-reading.
Collapse
 
strredwolf profile image
STrRedWolf
  1. Cheat Sheet 2-4 page reference.
  2. The O'Reily book on the subject for stuff that isn't covered in the condensed version.
  3. Online documentation for APIs.

Seriously. I don't have time to wade through loads of documentation and tutorials. Most languages are an off-shoot of:

  • C (Ex: C++, C#, Perl, Go, Java, Javascript)
  • QuickBasic/Visual Basic (Ex: Informix 4GL, Python, Ruby)
  • Assembly (Ex: 6502, x86, WebAssembly, BrainF**k)
  • Conway's Game of Life*

Note, they may not be off-shoots by timing, but in terms of language structure and style.

Most tutorials are "here's how to program, we'll use X language to teach you." Did that too many times. Don't need to do it again.

So condense it down, give me a ref with some examples, and make sure someone's got a book on it from O'Reily. Rarely will I see a "C does it this way, X lang does it that way" document.

(* I threw that in because a team of bored folk made Tetris in CGoL. Talk about really low level programming!)

Collapse
 
farnabaz profile image
Ahad Birang
  • Read a hello world tutorial
  • Write a sample project and start to develope it and add more features to it
  • Search and read docs to find best practice
  • Join StackOverflow and try to solve others problem
Collapse
 
lancecontreras profile image
Lance Contreras

Majority of the learning process is through getting a training in my work. I mean you learn a lot in school but in the corporate world it could be different.

I'm fortunate enough to be employed in a company where you can learn from a lot of people around you. And they sponsor a classroom training for the newbies.

Right now I'm trying to learn C and to do that on my own, I am following a set of exercises online. I realized doing exercises is the fastest way to learn and appreciate a programming language. After all, experience is the best teacher.