Hi folks,<p>I'm a JS dev and I would like to learn a new language. Probably Python or Go.<p>How did you learn a new programming language as an experienced dev? What was your approach?<p>Do you know an interactive website that explains different language features or design patterns using JS code fragments and their Python / Go equivalents?<p>It seems like a good approach to shorten my learning curve.
Unfortunately, I didn't find a good one so far.<p>Thx.
For me, project based learning is the best method for learning a new language. Basically, pick a language and build something with it. Doesn't matter what. Going this route helps you get a feel for the language, how you might actually go about building something in practice, etc., which is much more valuable information than some rando's thoughts about the language in a blog post.<p>Building a CHIP-8 emulator is a fun first project (and generally very approachable -- there's a C tutorial at <a href="https://austinmorlan.com/posts/chip8_emulator/" rel="nofollow">https://austinmorlan.com/posts/chip8_emulator/</a>, which is helpful for understanding what approach you might take to get something working in another language). For Go specifically, I learned via <a href="https://interpreterbook.com/" rel="nofollow">https://interpreterbook.com/</a> (and the sequel, <a href="https://compilerbook.com/" rel="nofollow">https://compilerbook.com/</a>).<p>IMO, stay away from Rosetta Code unless you're really, really stuck. You don't want to e.g. write Python in a Javascript-y way. You should learn the Python way as much as possible.
If you are experienced in JavaScript, switching to Python is not that hard to do. The languages' similarities outweigh their differences. I have been accused of writing Python with a heavy JavaScript accent.<p>The harder part of that transition is environment issues. Switching between Node environments is a solved problem. Include an .nvmrc in your project and you're done. It's very much not a solved problem in python-land.<p>>Do you know an interactive website that explains different language features or design patterns using JS code fragments and their Python / Go equivalents?<p><a href="https://rosettacode.org/wiki/Rosetta_Code" rel="nofollow">https://rosettacode.org/wiki/Rosetta_Code</a>
Depends on what you already know, how you learn and what documentation is available.<p>The three languages you mention look similar enough to not need those side-by-side examples. When you read their tutorials, you’ll probably be able to make them yourself, if needed.<p>For python, <a href="https://docs.python.org/3/tutorial/index.html" rel="nofollow">https://docs.python.org/3/tutorial/index.html</a>) seems broad and deep enough to get anybody going.<p>For Go there is “a tour of Go” (<a href="https://go.dev/tour/welcome/1" rel="nofollow">https://go.dev/tour/welcome/1</a>). That looks good, too.<p>(Aside: both may go about equivalently deep and broad into the language, but the python one chose to show you a long list of links, while the go one hid that by only showing links to the top level chapters. That’s less scary, but makes it harder to jump back to specific sections later if you want to reread them)<p>Once you know a language, you’ll have to learn available libraries.
I have a standard project that I do whenever I learn a new language. The reason I do the same project each time is that I already know all of the business logic, so all I need to focus on for the new project is the language and syntax, not the business logic.<p>My chosen project is a MUD, which is a text-based MMORPG, effectively. I already know how the TCP connections work, how to load areas/zones, how to establish characters and monsters, and how all of those things interact. So all I really need to learn is the language.<p>So my advice would be to pick something you've already built in the past in a language that you're vary familiar with, then port it to the new language. It's easier than coming up with something from scratch.<p>Your mileage may vary, but this generally works very well for me.
I used "A Tour of Go"[0] which was enough having come from C/C++ and Java backgrounds. Coming from a JS background you would be missing some context about the differences between variables, data, and references/pointers. Eventually the distinction between concurrency and async might need some brushing-up on as well.<p>Learning Python should be much more straightforward as the way it runs is more similar to JS.<p>[0] <a href="https://go.dev/tour/welcome/1" rel="nofollow">https://go.dev/tour/welcome/1</a>
As a JS dev learning python should be trivial. As language python is much easier. The main issue is it lacks many libraries that you are used to working with in the js world - but thats because python isnt really a web language.<p>All in all learning the basics should take no longer than two to three weeks, despite lower quality documentation.<p>One way to do it may be to pick one of the many useful node libraries and implementing them in python.
I do a quick overview of the syntax - I check out a syntax book, cheatsheet pages or the language documentation. Then I do the "Getting started" section. After that, I try to build a project. If it's a new one, I reduce the scope to be about one or 2 days worth of tinkering and a lot of readings of documentation and other codebases.
1/ I pick challenges I want to solve, which are amenable to be approached through the lens of the language of choice I want to learn (e.g., a highly available app in Erlang, a system level command line utility in Rust). 2/ I source books, code bases, and papers that can inform my practice oriented learning process. 3/ Start hacking.
buy a book, any book, do all the exercises in it. after you finish that book, for any other questions you have about the language...Google<p>Don't make this any harder than it needs to be young buck.
Hackerrank!<p>I needed to brush up on some interviewing skills and it was a nice way to focus on just the very basics of syntax. Once I was comfortable I started 'golfing' in the language on hackerrank for fun, and then I moved onto making some fun toy applications in a legit dev environment.
You can find quite a few 3h long video intros to a language on YouTube. Put that on 3x the speed to get the basic feel for the language. I've found it better than articles, since it shows the not only the language, but also the environment and workflows.
My approach has been always like this.<p>1. Shortlist a couple languages
2. Read a brief summary and some articles espousing the virtues of the langues
3. Get a sense of which feels most enticing and then pick one
4. Setup a small project with a alignment to the strengths of the language (possibly port one from a previous language)
5. Build and document the code base as you learn and leave notes in comments to various tutorials as they apply.
6. Package it up and strip out the barebones and make a simple empty shell that can be used to bootstrap future projects
I usually run through a free Codecademy course if there is one, and then follow a course or two in the target language. I'm not sure the equivalent approach might be useful, since different languages take different views of programming.