14
votes
What is your go-to project for learning a new language?
Ive been playing around with learning a lisp language for a while, and I recently decided to go for it and learn fennel (as I already am comfortable with lua) just to see if I like lisps as a class. Normally, I try to do the first 5-10 days of a previous advent of code to pick up a lang.
Setting up my advent of code environment got me wondering: what projects do other people use to learn new languages/tooling? Id love to hear how other people approach learning a new skill.
Hm, I haven't gotten around to properly doing this apart from my day job, but depending on language you could also throw in Project Euler for algorithmic stuff, something like ToDoMVC for frontend-focused languages or generally some kind of "code katas" used to be big too.
All these toy things aside, I believe the actual best thing would be something you actually want to have or use, which would provide additional motivation as well as actual "requirements" or fun ideas to work on.
Maybe a little game, as well.
That's exactly what I was coming here to suggest :)
@hpr's suggestion of writing something you actually want to use is the other big one. For me, writing a couple of projects I actually use every day is the main reason I was able to learn Zig.
I tend to do something I am fairly familiar with domain wise. Learning F# a while back I did a parser for Swedish accounting data using parser combinations via fparsec. I hadn't done much with parser combinations before, but I knew the file format fairly well. Other times I build a lisp :) getting a basic interpreter is fairly straightforward (the book SICP is a good reference manual for this).
Contrary to other people's recommendation I would avoid building something I actually want to use. I want a certain level of mastery and understanding of the tool (language) before doing anything "serious" with it. YMMV.
I'm the same. If I finish (for some definition of the word, hehe) the project, but decide I don't really care to use the language in the future, I'm stuck maintaining a thing I use in a language I don't want to use.
https://codegolf.stackexchange.com/questions/33172/american-gothic-in-the-palette-of-mona-lisa-rearrange-the-pixels
Take pixels from picture A and try to use them to create picture B.
It deals with file IO, arrays, heavy math comparisons, I have a local server set up to animate my output so it involves web calls, and I try new ways to solve the problem each time because there is no "correct" solution.
Not sure how generalizable this is, but I started learning Rust by going through Ray Tracing in One Weekend and translating as I go. It looks like someone's published a version for Rust specifically, but I actually found a lot of value in having to translate myself.
It's a good blend of not having to worry too much about the project/structure (as it's all planned out for you) but still forcing you to identify the goals and learn what language tools to apply.
There is a 1978 book called Etudes for Programmers (overview here, but you can find a full PDF pretty easily) that has a bunch of problems that most software developers think they can solve, but that most software developers have never actually sat down and solved. Things like simulating Conway's Game of Life, or a basic accounting system, or the AI for a simple board game.
I've only done a few of them, but they feel more satisfying than some of the Advent of Code/Project Euler puzzles, although I enjoy those quite a bit as well.
I implement a Conways Game Of Life. And the classic game of robots.
I’ve done these in every language I’ve learned, from Forth to C to BASIC, COBOL, rust, pascal, java, python, and more, and numerous assembly languages.
One of the more interesting to me was re appraising my 6502 on the Commander X16 a few years back when the emulator first launched.
I pretty much exclusively want to make command line interface/text user interface apps, so my first thing to do to try to shake out any language is to attempt to find how it handles console-based input an output.
So far other than a couple of libraries in python, I’ve been very disappointed by how little modern programming languages tend to support the CLI. Many of them do have some sort of very lightweight Io, but if you’re looking for things like proper ANSI codes or anything like that, best to just stick with things like Python. Sad thing is, I really don’t care for Python. My preference tends to go towards functional languages like Haskell and LISP, and procedural languages like Odin, and Go.
(I guess technically there are some good ones for JavaScript, but I hate node with a burning passion, I can’t figure out deno, and to be honest, I just don’t much care for either JavaScript or TypeScript.)
I try and find some ncurses bindings when I’m doing my learning projects. An oldie but goodie.